C# Class Castle.MonoRail.Framework.Controller

Implements the core functionality and exposes the common methods for concrete controllers.
Inheritance: IAsyncController, IValidatorAccessor, IRedirectSupport
Show file Open project: nats/castle-1.0.3-mono Class Usage Examples

Private Properties

Property Type Description
RedirectToReferer void
ResetIsPostback void
SetEvaluatedAction void
TransformActionName string

Public Methods

Method Description
CancelLayout ( ) : void

Cancels the layout processing.

CancelView ( ) : void

Cancels the view processing.

Controller ( ) : System

Constructs a Controller

DeliverEmail ( Message message ) : void

Attempts to deliver the Message using the server specified on the web.config.

DirectRender ( string contents ) : void

Sends raw contents to be rendered directly by the view engine. It's up to the view engine just to apply the layout and nothing else.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

HasTemplate ( string templateName ) : bool

Returns true if the specified template exists.

InPlaceRenderSharedView ( TextWriter output, string name ) : void

Specifies the shared view to be processed and results are written to System.IO.TextWriter. (A partial view shared by others views and usually in the root folder of the view directory).

InPlaceRenderView ( TextWriter output, string name ) : void

Specifies the view to be processed and results are written to System.IO.TextWriter.

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

Initializes the state of the controller.

InitializeFieldsFromServiceProvider ( IRailsEngineContext context ) : void

Extracts the services the controller uses from the context -- which ultimately is a service provider.

PostSendView ( object view ) : void

Invoked by the view engine to perform any logic after the view had been sent to the client.

PreSendView ( object view ) : void

Invoked by the view engine to perform any logic before the view is sent to the client.

Redirect ( string url ) : void

Redirects to the specified URL. All other Redirects call this one.

Redirect ( string url, IDictionary parameters ) : void

Redirects to the specified URL.

Redirect ( string url, NameValueCollection parameters ) : void

Redirects to the specified URL.

Redirect ( string controller, string action ) : void

Redirects to another controller and action.

Redirect ( string controller, string action, IDictionary parameters ) : void

Redirects to another controller and action with the specified paramters.

Redirect ( string controller, string action, NameValueCollection parameters ) : void

Redirects to another controller and action with the specified paramters.

Redirect ( string area, string controller, string action ) : void

Redirects to another controller and action.

Redirect ( string area, string controller, string action, IDictionary parameters ) : void

Redirects to another controller and action with the specified paramters.

Redirect ( string area, string controller, string action, NameValueCollection parameters ) : void

Redirects to another controller and action with the specified paramters.

RedirectToSiteRoot ( ) : void

Redirects to the site root directory (Context.ApplicationPath + "/").

RenderEmailAndSend ( string templateName ) : void

Renders and delivers the e-mail message. DeliverEmail

RenderMailMessage ( string templateName ) : Message

Creates an instance of Message using the specified template for the body

RenderMailMessage ( string templateName, bool doNotApplyLayout ) : Message

Creates an instance of Message using the specified template for the body

RenderSharedView ( string name ) : void

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).

RenderSharedView ( string name, bool skipLayout ) : void

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).

RenderText ( IFormatProvider formatProvider, string contents ) : void

Cancels the view processing and writes the specified contents to the browser

RenderText ( string contents ) : void

Cancels the view processing and writes the specified contents to the browser

RenderView ( string name ) : void

Specifies the view to be processed after the action has finished its processing.

RenderView ( string name, bool skipLayout ) : void

Specifies the view to be processed after the action has finished its processing.

RenderView ( string name, bool skipLayout, string mimeType ) : void

Specifies the view to be processed after the action has finished its processing.

RenderView ( string controller, string name ) : void

Specifies the view to be processed after the action has finished its processing.

RenderView ( string controller, string name, bool skipLayout ) : void

Specifies the view to be processed after the action has finished its processing.

RenderView ( string controller, string name, bool skipLayout, string mimeType ) : void

Specifies the view to be processed after the action has finished its processing.

RenderView ( string controller, string name, string mimeType ) : void

Specifies the view to be processed after the action has finished its processing.

Send ( string action ) : void

Performs the specified action, which means:
1. Define the default view name
2. Run the before filters
3. Select the method related to the action name and invoke it
4. On error, execute the rescues if available
5. Run the after filters
6. Invoke the view engine

Send ( string action, IDictionary actionArgs ) : void

Performs the specified action with arguments.

Protected Methods

Method Description
CreateValidatorRunner ( IValidatorRegistry validatorRegistry ) : Castle.Components.Validator.ValidatorRunner

Creates the default validator runner.

You can override this method to create a runner with some different configuration

Initialize ( ) : void

Initializes this instance. Implementors can use this method to perform initialization

InternalSend ( string action, IDictionary actionArgs ) : void

Performs the specified action, which means:
1. Define the default view name
2. Run the before filters
3. Select the method related to the action name and invoke it
4. On error, execute the rescues if available
5. Run the after filters
6. Invoke the view engine

InvokeMethod ( MethodInfo method, IDictionary methodArgs ) : void

Pendent

InvokeMethod ( MethodInfo method, IRequest request, IDictionary methodArgs ) : void

Pendent

RedirectToAction ( string action ) : void

Redirects to another action in the same controller.

RedirectToAction ( string action, IDictionary queryStringParameters ) : void

Redirects to another action in the same controller.

RedirectToAction ( string action, NameValueCollection queryStringParameters ) : void

Redirects to another action in the same controller.

RedirectToReferrer ( ) : void

Redirects to the referrer action, according to the "HTTP_REFERER" header (Context.UrlReferrer).

SelectMethod ( string action, IDictionary actions, IRequest request, IDictionary actionArgs ) : MethodInfo

Pendent

ToQueryString ( IDictionary parameters ) : string

Creates a querystring string representation of the entries in the dictionary.

ToQueryString ( NameValueCollection parameters ) : string

Creates a querystring string representation of the namevalue collection.

Private Methods

Method Description
RedirectToReferer ( ) : void
ResetIsPostback ( ) : void

To preserve standard Action semantics when using ASP.NET Views, the event handlers in the CodeBehind typically call Send(String). As a result, the IsPostBack property must be logically cleared to allow the Action to behave as if it was called directly.

SetEvaluatedAction ( string actionName ) : void

Sets the evaluated action.

TransformActionName ( string action ) : string

Gives a chance to subclasses to format the action name properly WizardStepPage

Method Details

CancelLayout() public method

Cancels the layout processing.
public CancelLayout ( ) : void
return void

CancelView() public method

Cancels the view processing.
public CancelView ( ) : void
return void

Controller() public method

Constructs a Controller
public Controller ( ) : System
return System

CreateValidatorRunner() protected method

Creates the default validator runner.
You can override this method to create a runner with some different configuration
protected CreateValidatorRunner ( IValidatorRegistry validatorRegistry ) : Castle.Components.Validator.ValidatorRunner
validatorRegistry IValidatorRegistry The validator registry.
return Castle.Components.Validator.ValidatorRunner

DeliverEmail() public method

Attempts to deliver the Message using the server specified on the web.config.
public DeliverEmail ( Message message ) : void
message Message The instance of System.Web.Mail.MailMessage that will be sent
return void

DirectRender() public method

Sends raw contents to be rendered directly by the view engine. It's up to the view engine just to apply the layout and nothing else.
public DirectRender ( string contents ) : void
contents string Contents to be rendered.
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

HasTemplate() public method

Returns true if the specified template exists.
public HasTemplate ( string templateName ) : bool
templateName string
return bool

InPlaceRenderSharedView() public method

Specifies the shared view to be processed and results are written to System.IO.TextWriter. (A partial view shared by others views and usually in the root folder of the view directory).
public InPlaceRenderSharedView ( TextWriter output, string name ) : void
output System.IO.TextWriter
name string The name of the view to process.
return void

InPlaceRenderView() public method

Specifies the view to be processed and results are written to System.IO.TextWriter.
public InPlaceRenderView ( TextWriter output, string name ) : void
output System.IO.TextWriter
name string The name of the view to process.
return void

Initialize() protected method

Initializes this instance. Implementors can use this method to perform initialization
protected Initialize ( ) : void
return void

InitializeControllerState() public method

Initializes the state of the controller.
public InitializeControllerState ( string areaName, string controllerName, string actionName ) : void
areaName string Name of the area.
controllerName string Name of the controller.
actionName string Name of the action.
return void

InitializeFieldsFromServiceProvider() public method

Extracts the services the controller uses from the context -- which ultimately is a service provider.
public InitializeFieldsFromServiceProvider ( IRailsEngineContext context ) : void
context IRailsEngineContext The context/service provider.
return void

InternalSend() protected method

Performs the specified action, which means:
1. Define the default view name
2. Run the before filters
3. Select the method related to the action name and invoke it
4. On error, execute the rescues if available
5. Run the after filters
6. Invoke the view engine
protected InternalSend ( string action, IDictionary actionArgs ) : void
action string Action name
actionArgs IDictionary Action arguments
return void

InvokeMethod() protected method

Pendent
protected InvokeMethod ( MethodInfo method, IDictionary methodArgs ) : void
method System.Reflection.MethodInfo
methodArgs IDictionary
return void

InvokeMethod() protected method

Pendent
protected InvokeMethod ( MethodInfo method, IRequest request, IDictionary methodArgs ) : void
method System.Reflection.MethodInfo
request IRequest
methodArgs IDictionary
return void

PostSendView() public method

Invoked by the view engine to perform any logic after the view had been sent to the client.
public PostSendView ( object view ) : void
view object
return void

PreSendView() public method

Invoked by the view engine to perform any logic before the view is sent to the client.
public PreSendView ( object view ) : void
view object
return void

Redirect() public method

Redirects to the specified URL. All other Redirects call this one.
public Redirect ( string url ) : void
url string Target URL
return void

Redirect() public method

Redirects to the specified URL.
public Redirect ( string url, IDictionary parameters ) : void
url string Target URL
parameters IDictionary URL parameters
return void

Redirect() public method

Redirects to the specified URL.
public Redirect ( string url, NameValueCollection parameters ) : void
url string Target URL
parameters System.Collections.Specialized.NameValueCollection URL parameters
return void

Redirect() public method

Redirects to another controller and action.
public Redirect ( string controller, string action ) : void
controller string Controller name
action string Action name
return void

Redirect() public method

Redirects to another controller and action with the specified paramters.
public Redirect ( string controller, string action, IDictionary parameters ) : void
controller string Controller name
action string Action name
parameters IDictionary Key/value pairings
return void

Redirect() public method

Redirects to another controller and action with the specified paramters.
public Redirect ( string controller, string action, NameValueCollection parameters ) : void
controller string Controller name
action string Action name
parameters System.Collections.Specialized.NameValueCollection Key/value pairings
return void

Redirect() public method

Redirects to another controller and action.
public Redirect ( string area, string controller, string action ) : void
area string Area name
controller string Controller name
action string Action name
return void

Redirect() public method

Redirects to another controller and action with the specified paramters.
public Redirect ( string area, string controller, string action, IDictionary parameters ) : void
area string Area name
controller string Controller name
action string Action name
parameters IDictionary Key/value pairings
return void

Redirect() public method

Redirects to another controller and action with the specified paramters.
public Redirect ( string area, string controller, string action, NameValueCollection parameters ) : void
area string Area name
controller string Controller name
action string Action name
parameters System.Collections.Specialized.NameValueCollection Key/value pairings
return void

RedirectToAction() protected method

Redirects to another action in the same controller.
protected RedirectToAction ( string action ) : void
action string The action name
return void

RedirectToAction() protected method

Redirects to another action in the same controller.
protected RedirectToAction ( string action, IDictionary queryStringParameters ) : void
action string The action name
queryStringParameters IDictionary Query string entries
return void

RedirectToAction() protected method

Redirects to another action in the same controller.
protected RedirectToAction ( string action, NameValueCollection queryStringParameters ) : void
action string The action name
queryStringParameters System.Collections.Specialized.NameValueCollection Query string entries
return void

RedirectToReferrer() protected method

Redirects to the referrer action, according to the "HTTP_REFERER" header (Context.UrlReferrer).
protected RedirectToReferrer ( ) : void
return void

RedirectToSiteRoot() public method

Redirects to the site root directory (Context.ApplicationPath + "/").
public RedirectToSiteRoot ( ) : void
return void

RenderEmailAndSend() public method

Renders and delivers the e-mail message. DeliverEmail
public RenderEmailAndSend ( string templateName ) : void
templateName string
return void

RenderMailMessage() public method

Creates an instance of Message using the specified template for the body
public RenderMailMessage ( string templateName ) : Message
templateName string /// Name of the template to load. /// Will look in Views/mail for that template file. ///
return Message

RenderMailMessage() public method

Creates an instance of Message using the specified template for the body
public RenderMailMessage ( string templateName, bool doNotApplyLayout ) : Message
templateName string /// Name of the template to load. /// Will look in Views/mail for that template file. ///
doNotApplyLayout bool If true, it will skip the layout
return Message

RenderSharedView() public method

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).
public RenderSharedView ( string name ) : void
name string
return void

RenderSharedView() public method

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).
public RenderSharedView ( string name, bool skipLayout ) : void
name string
skipLayout bool
return void

RenderText() public method

Cancels the view processing and writes the specified contents to the browser
public RenderText ( IFormatProvider formatProvider, string contents ) : void
formatProvider IFormatProvider
contents string
return void

RenderText() public method

Cancels the view processing and writes the specified contents to the browser
public RenderText ( string contents ) : void
contents string
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string name ) : void
name string view template name (the file extension is optional)
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string name, bool skipLayout ) : void
name string view template name (the file extension is optional)
skipLayout bool If set to true, no layout will be used when rendering the view
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string name, bool skipLayout, string mimeType ) : void
name string view template name (the file extension is optional)
skipLayout bool If set to true, no layout will be used when rendering the view
mimeType string The mime type to use on the reply
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string controller, string name ) : void
controller string Controller name get view from (if you intend to user another controller's view
name string view template name (the file extension is optional)
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string controller, string name, bool skipLayout ) : void
controller string Controller name get view from (if you intend to user another controller's view
name string view template name (the file extension is optional)
skipLayout bool If set to true, no layout will be used when rendering the view
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string controller, string name, bool skipLayout, string mimeType ) : void
controller string Controller name get view from (if you intend to user another controller's view
name string view template name (the file extension is optional)
skipLayout bool If set to true, no layout will be used when rendering the view
mimeType string The mime type to use on the reply
return void

RenderView() public method

Specifies the view to be processed after the action has finished its processing.
public RenderView ( string controller, string name, string mimeType ) : void
controller string Controller name get view from (if you intend to user another controller's view
name string view template name (the file extension is optional)
mimeType string The mime type to use on the reply
return void

SelectMethod() protected method

Pendent
protected SelectMethod ( string action, IDictionary actions, IRequest request, IDictionary actionArgs ) : MethodInfo
action string
actions IDictionary
request IRequest
actionArgs IDictionary
return System.Reflection.MethodInfo

Send() public method

Performs the specified action, which means:
1. Define the default view name
2. Run the before filters
3. Select the method related to the action name and invoke it
4. On error, execute the rescues if available
5. Run the after filters
6. Invoke the view engine
public Send ( string action ) : void
action string Action name
return void

Send() public method

Performs the specified action with arguments.
public Send ( string action, IDictionary actionArgs ) : void
action string Action name
actionArgs IDictionary Action arguments
return void

ToQueryString() protected method

Creates a querystring string representation of the entries in the dictionary.
protected ToQueryString ( IDictionary parameters ) : string
parameters IDictionary The parameters.
return string

ToQueryString() protected method

Creates a querystring string representation of the namevalue collection.
protected ToQueryString ( NameValueCollection parameters ) : string
parameters System.Collections.Specialized.NameValueCollection The parameters.
return string