- Fixed MR-84
[castle.git] / MonoRail / Castle.MonoRail.Framework / IController.cs
blob9bd912446ebeb72b3466e9ab64e045e0c2d11e30
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
18 using System.Collections;
19 using System.Collections.Specialized;
20 using System.IO;
21 using Internal;
23 /// <summary>
24 /// Represent the core functionality required out of a controller
25 /// </summary>
26 public interface IController : IDisposable
28 /// <summary>
29 /// Gets the view folder -- (areaname +
30 /// controllername) or just controller name -- that this controller
31 /// will use by default.
32 /// </summary>
33 string ViewFolder { get; }
35 /// <summary>
36 /// Gets a dicitionary of name/<see cref="IResource"/>
37 /// </summary>
38 /// <remarks>It is supposed to be used by MonoRail infrastructure only</remarks>
39 /// <value>The resources.</value>
40 ResourceDictionary Resources { get; }
42 /// <summary>
43 /// Gets a dictionary of name/helper instance
44 /// </summary>
45 /// <value>The helpers.</value>
46 IDictionary Helpers { get; }
48 /// <summary>
49 /// Gets the controller's name.
50 /// </summary>
51 string Name { get; }
53 /// <summary>
54 /// Gets the controller's area name.
55 /// </summary>
56 string AreaName { get; }
58 /// <summary>
59 /// Gets or set the layout being used.
60 /// </summary>
61 string LayoutName { get; set; }
63 /// <summary>
64 /// Gets the name of the action being processed.
65 /// </summary>
66 string Action { get; }
68 /// <summary>
69 /// Gets or sets the view which will be rendered by this action.
70 /// </summary>
71 string SelectedViewName { get; set; }
73 /// <summary>
74 /// Gets the property bag, which is used
75 /// to pass variables to the view.
76 /// </summary>
77 IDictionary PropertyBag { get; set; }
79 /// <summary>
80 /// Gets a dictionary of volative items.
81 /// Ideal for showing success and failures messages.
82 /// </summary>
83 Flash Flash { get; }
85 /// <summary>
86 /// Gets the request object.
87 /// </summary>
88 IRequest Request { get; }
90 /// <summary>
91 /// Gets the response object.
92 /// </summary>
93 IResponse Response { get; }
95 /// <summary>
96 /// Shortcut to <see cref="IRequest.Params"/>
97 /// </summary>
98 NameValueCollection Params { get; }
100 /// <summary>
101 /// Shortcut to <see cref="IRequest.Form"/>
102 /// </summary>
103 NameValueCollection Form { get; }
105 /// <summary>
106 /// Shortcut to <see cref="IRequest.QueryString"></see>
107 /// </summary>
108 NameValueCollection Query { get; }
110 /// <summary>
111 /// Performs the specified action, which means:
112 /// <br/>
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/>
119 /// </summary>
120 /// <param name="action">Action name</param>
121 void Send(string action);
123 /// <summary>
124 /// Performs the specified action with arguments.
125 /// </summary>
126 /// <param name="action">Action name</param>
127 /// <param name="actionArgs">Action arguments</param>
128 void Send(string action, IDictionary actionArgs);
130 /// <summary>
131 /// Invoked by the view engine to perform
132 /// any logic before the view is sent to the client.
133 /// </summary>
134 /// <param name="view"></param>
135 void PreSendView(object view);
137 /// <summary>
138 /// Invoked by the view engine to perform
139 /// any logic after the view had been sent to the client.
140 /// </summary>
141 /// <param name="view"></param>
142 void PostSendView(object view);
144 /// <summary>
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).
148 /// </summary>
149 /// <param name="output"></param>
150 /// <param name="name">The name of the view to process.</param>
151 void InPlaceRenderSharedView(TextWriter output, string name);