1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
18 using System
.Collections
;
19 using System
.Collections
.Specialized
;
24 /// Represent the core functionality required out of a controller
26 public interface IController
: IDisposable
29 /// Gets the view folder -- (areaname +
30 /// controllername) or just controller name -- that this controller
31 /// will use by default.
33 string ViewFolder { get; }
36 /// Gets a dicitionary of name/<see cref="IResource"/>
38 /// <remarks>It is supposed to be used by MonoRail infrastructure only</remarks>
39 /// <value>The resources.</value>
40 ResourceDictionary Resources { get; }
43 /// Gets a dictionary of name/helper instance
45 /// <value>The helpers.</value>
46 IDictionary Helpers { get; }
49 /// Gets the controller's name.
54 /// Gets the controller's area name.
56 string AreaName { get; }
59 /// Gets or set the layout being used.
61 string LayoutName { get; set; }
64 /// Gets the name of the action being processed.
66 string Action { get; }
69 /// Gets or sets the view which will be rendered by this action.
71 string SelectedViewName { get; set; }
74 /// Gets the property bag, which is used
75 /// to pass variables to the view.
77 IDictionary PropertyBag { get; set; }
80 /// Gets a dictionary of volative items.
81 /// Ideal for showing success and failures messages.
86 /// Gets the request object.
88 IRequest Request { get; }
91 /// Gets the response object.
93 IResponse Response { get; }
96 /// Shortcut to <see cref="IRequest.Params"/>
98 NameValueCollection Params { get; }
101 /// Shortcut to <see cref="IRequest.Form"/>
103 NameValueCollection Form { get; }
106 /// Shortcut to <see cref="IRequest.QueryString"></see>
108 NameValueCollection Query { get; }
111 /// Performs the specified action, which means:
113 /// 1. Define the default view name<br/>
114 /// 2. Run the before filters<br/>
115 /// 3. Select the method related to the action name and invoke it<br/>
116 /// 4. On error, execute the rescues if available<br/>
117 /// 5. Run the after filters<br/>
118 /// 6. Invoke the view engine<br/>
120 /// <param name="action">Action name</param>
121 void Send(string action
);
124 /// Performs the specified action with arguments.
126 /// <param name="action">Action name</param>
127 /// <param name="actionArgs">Action arguments</param>
128 void Send(string action
, IDictionary actionArgs
);
131 /// Invoked by the view engine to perform
132 /// any logic before the view is sent to the client.
134 /// <param name="view"></param>
135 void PreSendView(object view
);
138 /// Invoked by the view engine to perform
139 /// any logic after the view had been sent to the client.
141 /// <param name="view"></param>
142 void PostSendView(object view
);
145 /// Specifies the shared view to be processed and results are written to System.IO.TextWriter.
146 /// (A partial view shared by others views and usually in the root folder
147 /// of the view directory).
149 /// <param name="output"></param>
150 /// <param name="name">The name of the view to process.</param>
151 void InPlaceRenderSharedView(TextWriter output
, string name
);