Minor style changes
[castle.git] / MonoRail / Castle.MonoRail.Framework / IRailsEngineContext.cs
blob6237f37c1fdbba4f7fc53e87a61195829a9c698f
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.ComponentModel.Design;
19 using System.Web;
20 using System.Security.Principal;
21 using System.Collections;
22 using System.Collections.Specialized;
24 /// <summary>
25 /// Represents an abstraction between the MonoRail API
26 /// and the ASP.Net API.
27 /// </summary>
28 public interface IRailsEngineContext : IServiceContainer
30 /// <summary>
31 /// Gets the request type (GET, POST, etc)
32 /// </summary>
33 String RequestType { get; }
35 /// <summary>
36 /// Gets the request URL.
37 /// </summary>
38 String Url { get; }
40 /// <summary>
41 /// Gets the referring URL.
42 /// </summary>
43 String UrlReferrer { get; }
45 /// <summary>
46 /// Gets the underlying context of the API being used.
47 /// </summary>
48 HttpContext UnderlyingContext { get; }
50 /// <summary>
51 /// Access the params (Query, Post, headers and Cookies)
52 /// </summary>
53 NameValueCollection Params { get; }
55 /// <summary>
56 /// Access the session objects.
57 /// </summary>
58 IDictionary Session { get; }
60 /// <summary>
61 /// Gets the request object.
62 /// </summary>
63 IRequest Request { get; }
65 /// <summary>
66 /// Gets the response object.
67 /// </summary>
68 IResponse Response { get; }
70 /// <summary>
71 /// Gets the trace object.
72 /// </summary>
73 ITrace Trace { get; }
75 /// <summary>
76 /// Access the Cache associated with this
77 /// web execution context.
78 /// </summary>
79 ICacheProvider Cache { get; }
81 /// <summary>
82 /// Access a dictionary of volative items.
83 /// </summary>
84 Flash Flash { get; }
86 /// <summary>
87 /// Transfer the execution to another resource.
88 /// </summary>
89 /// <param name="path"></param>
90 /// <param name="preserveForm"></param>
91 void Transfer( String path, bool preserveForm );
93 /// <summary>
94 /// Gets or sets the current user.
95 /// </summary>
96 IPrincipal CurrentUser { get; set; }
98 /// <summary>
99 /// Gets the last exception raised during
100 /// the execution of an action.
101 /// </summary>
102 Exception LastException { get; set; }
104 /// <summary>
105 /// Returns the application path.
106 /// </summary>
107 String ApplicationPath { get; }
109 /// <summary>
110 /// Returns the physical application path.
111 /// </summary>
112 String ApplicationPhysicalPath { get; }
114 /// <summary>
115 /// Returns the <see cref="UrlInfo"/> of the the current request.
116 /// </summary>
117 UrlInfo UrlInfo { get; }
119 /// <summary>
120 /// Returns an <see cref="IServerUtility"/>.
121 /// </summary>
122 IServerUtility Server { get; }
124 /// <summary>
125 /// Returns the Items collection from the current HttpContext.
126 /// </summary>
127 IDictionary Items { get; }
129 /// <summary>
130 /// Gets or sets the current controller.
131 /// </summary>
132 /// <value>The current controller.</value>
133 IController CurrentController { get; set; }
135 /// <summary>
136 /// If a container is available for the app, this
137 /// property exposes its instance.
138 /// </summary>
139 IServiceProvider Container { get; }
141 /// <summary>
142 /// Request a service from the engine context.
143 /// </summary>
144 /// <typeparam name="T">Service type</typeparam>
145 /// <returns>Service instance</returns>
146 T GetService<T>();