C# Class Castle.MonoRail.Framework.ControllerLifecycleExecutor

Default implementation of IControllerLifecycleExecutor

Handles the whole controller lifecycle in a request.

Inheritance: IControllerLifecycleExecutor, IServiceEnabledComponent
Show file Open project: nats/castle-1.0.3-mono

Public Methods

Method Description
ControllerLifecycleExecutor ( Controller controller, IRailsEngineContext context ) : System

Initializes a new instance of the ControllerLifecycleExecutor class.

Dispose ( ) : void

Disposes the filters and resources associated with a controller.

InitializeController ( string areaName, string controllerName, string actionName ) : void

Should bring the controller to an usable state by populating its fields with values that represent the current request

PerformErrorHandling ( ) : void

Performs the error handling:

- Tries to run the rescue page
- Throws the exception

ProcessSelectedAction ( ) : void

Executes the method or the dynamic action

ProcessSelectedAction ( IDictionary actionArgs ) : void

Executes the method or the dynamic action with custom arguments

RunStartRequestFilters ( ) : bool

Runs the start request filters.

SelectAction ( string actionName, string controllerName ) : bool

Selects the action to execute based on the url information

SelectAction ( string actionName, string controllerName, IDictionary actionArgs ) : bool

Selects the action to execute based on the url information

Service ( IServiceProvider provider ) : void

Invoked by the framework in order to give a chance to obtain other services

Protected Methods

Method Description
CopyFilterDescriptors ( ) : Castle.MonoRail.Framework.Internal.FilterDescriptor[]

Clones all Filter descriptors, in order to get a writable copy.

CreateAndInitializeHelpers ( ) : void

Creates the and initialize helpers associated with a controller.

CreateResources ( MethodInfo method ) : void

Creates the resources associated with a controller

GetRescueFor ( IList rescues, Type exceptionType ) : RescueDescriptor

Gets the rescue for the specified exception type.

ObtainDefaultLayoutName ( ) : String

Obtains the name of the default layout.

PerformRescue ( MethodInfo method, Exception ex ) : bool

Performs the rescue.

PrepareTransformFilter ( MethodInfo method ) : void

Prepares the transform filter.

RaiseOnActionExceptionOnExtension ( ) : void

Raises the on action exception on extension.

ReleaseResources ( ) : void

Releases the resources.

ShouldSkip ( MethodInfo method ) : bool

Identifies if no filter should run for the given action.

Private Methods

Method Description
CreateFiltersDescriptors ( ) : void
CreateStandardHelpers ( IDictionary helpers ) : void
DisposeFilters ( ) : void
FindOutDefaultMethod ( IDictionary methodArgs ) : MethodInfo

The following lines were added to handle _default processing if present look for and load _default action method DefaultActionAttribute Method arguments

InitializeControllerFieldsFromServiceProvider ( ) : void
PerformAdditionalHelperInitialization ( object helperInstance ) : void

Performs the additional helper initialization checking if the helper instance implements IServiceEnabledComponent.

PrepareResources ( ) : void
PrepareTransformFilter ( ) : void
ProcessFilter ( ExecuteEnum when, FilterDescriptor desc ) : bool
ProcessFilters ( ExecuteEnum when ) : bool
ProcessScaffoldIfPresent ( ) : void

Invokes the scaffold support if the controller is associated with a scaffold

ProcessView ( ) : void
RunAfterActionFilters ( ) : void

Runs the after action filters.

RunAfterRenderFilters ( ) : void

Runs the after view rendering filters.

RunBeforeActionFilters ( ) : bool

Runs the after view rendering filters.

Method Details

ControllerLifecycleExecutor() public method

Initializes a new instance of the ControllerLifecycleExecutor class.
public ControllerLifecycleExecutor ( Controller controller, IRailsEngineContext context ) : System
controller Controller The controller.
context IRailsEngineContext The context.
return System

CopyFilterDescriptors() protected method

Clones all Filter descriptors, in order to get a writable copy.
protected CopyFilterDescriptors ( ) : Castle.MonoRail.Framework.Internal.FilterDescriptor[]
return Castle.MonoRail.Framework.Internal.FilterDescriptor[]

CreateAndInitializeHelpers() protected method

Creates the and initialize helpers associated with a controller.
protected CreateAndInitializeHelpers ( ) : void
return void

CreateResources() protected method

Creates the resources associated with a controller
protected CreateResources ( MethodInfo method ) : void
method System.Reflection.MethodInfo The method.
return void

Dispose() public method

Disposes the filters and resources associated with a controller.
public Dispose ( ) : void
return void

GetRescueFor() protected method

Gets the rescue for the specified exception type.
protected GetRescueFor ( IList rescues, Type exceptionType ) : RescueDescriptor
rescues IList The rescues.
exceptionType System.Type Type of the exception.
return Castle.MonoRail.Framework.Internal.RescueDescriptor

InitializeController() public method

Should bring the controller to an usable state by populating its fields with values that represent the current request
public InitializeController ( string areaName, string controllerName, string actionName ) : void
areaName string The area name
controllerName string The controller name
actionName string The action name
return void

ObtainDefaultLayoutName() protected method

Obtains the name of the default layout.
protected ObtainDefaultLayoutName ( ) : String
return String

PerformErrorHandling() public method

Performs the error handling:

- Tries to run the rescue page
- Throws the exception

public PerformErrorHandling ( ) : void
return void

PerformRescue() protected method

Performs the rescue.
protected PerformRescue ( MethodInfo method, Exception ex ) : bool
method System.Reflection.MethodInfo The action (can be null in the case of dynamic actions).
ex System.Exception The exception.
return bool

PrepareTransformFilter() protected method

Prepares the transform filter.
protected PrepareTransformFilter ( MethodInfo method ) : void
method MethodInfo The method.
return void

ProcessSelectedAction() public method

Executes the method or the dynamic action
public ProcessSelectedAction ( ) : void
return void

ProcessSelectedAction() public method

Executes the method or the dynamic action with custom arguments
public ProcessSelectedAction ( IDictionary actionArgs ) : void
actionArgs IDictionary The action args.
return void

RaiseOnActionExceptionOnExtension() protected method

Raises the on action exception on extension.
protected RaiseOnActionExceptionOnExtension ( ) : void
return void

ReleaseResources() protected method

Releases the resources.
protected ReleaseResources ( ) : void
return void

RunStartRequestFilters() public method

Runs the start request filters.
public RunStartRequestFilters ( ) : bool
return bool

SelectAction() public method

Selects the action to execute based on the url information
public SelectAction ( string actionName, string controllerName ) : bool
actionName string The action name
controllerName string The controller name
return bool

SelectAction() public method

Selects the action to execute based on the url information
public SelectAction ( string actionName, string controllerName, IDictionary actionArgs ) : bool
actionName string The action name
controllerName string The controller name
actionArgs IDictionary The action arguments.
return bool

Service() public method

Invoked by the framework in order to give a chance to obtain other services
public Service ( IServiceProvider provider ) : void
provider IServiceProvider The service proviver
return void

ShouldSkip() protected method

Identifies if no filter should run for the given action.
protected ShouldSkip ( MethodInfo method ) : bool
method MethodInfo The method.
return bool