Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / MonoRail / Castle.MonoRail.Framework / IRequest.cs
blob98aa0eb53a13610d0011da5a20df8d66854140b0
1 // Copyright 2004-2008 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.Web;
21 using Castle.Components.Binder;
23 /// <summary>
24 /// Defines where the parameters should be obtained from
25 /// </summary>
26 public enum ParamStore
28 /// <summary>
29 /// Query string
30 /// </summary>
31 QueryString,
32 /// <summary>
33 /// Only from the Form
34 /// </summary>
35 Form,
36 /// <summary>
37 /// From QueryString, Form and Environment variables.
38 /// </summary>
39 Params
42 /// <summary>
43 /// Represents the request data
44 /// </summary>
45 public interface IRequest
47 /// <summary>
48 /// Gets the accept header.
49 /// </summary>
50 /// <value>The accept header.</value>
51 string AcceptHeader { get; }
53 /// <summary>
54 /// Gets the request type (GET, POST, etc)
55 /// </summary>
56 [Obsolete("Use the property HttpMethod instead")]
57 String RequestType { get; }
59 /// <summary>
60 /// Gets additional path information for
61 /// a resource with a URL extension.
62 /// </summary>
63 /// <value>The path info.</value>
64 String PathInfo { get; }
66 /// <summary>
67 /// Gets the raw URL.
68 /// </summary>
69 /// <value>The raw URL.</value>
70 [Obsolete("Use the property Url instead")]
71 String RawUrl { get; }
73 /// <summary>
74 /// Gets the URI.
75 /// </summary>
76 /// <value>The URI.</value>
77 Uri Uri { get; }
79 /// <summary>
80 /// Gets the request URL.
81 /// </summary>
82 String Url { get; }
84 /// <summary>
85 /// Gets the referring URL.
86 /// </summary>
87 String UrlReferrer { get; }
89 /// <summary>
90 /// Gets the <see cref="HttpPostedFile"/> per key.
91 /// </summary>
92 IDictionary Files { get; }
94 /// <summary>
95 /// Gets the params which accumulates headers, post, querystring and cookies.
96 /// </summary>
97 /// <value>The params.</value>
98 NameValueCollection Params { get; }
100 /// <summary>
101 /// Gets the query string.
102 /// </summary>
103 /// <value>The query string.</value>
104 NameValueCollection QueryString { get; }
106 /// <summary>
107 /// Gets the form.
108 /// </summary>
109 /// <value>The form.</value>
110 NameValueCollection Form { get; }
112 /// <summary>
113 /// Gets the Http headers.
114 /// </summary>
115 /// <value>The Http headers.</value>
116 NameValueCollection Headers { get; }
118 /// <summary>
119 /// Indexer to access <see cref="Params"/> entries.
120 /// </summary>
121 /// <value></value>
122 string this[string name] { get; }
124 /// <summary>
125 /// Gets a value indicating whether this requeest is from a local address.
126 /// </summary>
127 /// <value><c>true</c> if this instance is local; otherwise, <c>false</c>.</value>
128 bool IsLocal { get; }
130 /// <summary>
131 /// Gets the HTTP method.
132 /// </summary>
133 /// <value>The HTTP method.</value>
134 String HttpMethod { get; }
136 /// <summary>
137 /// Gets the file path.
138 /// </summary>
139 /// <value>The file path.</value>
140 String FilePath { get; }
142 // /// <summary>
143 // /// Reads the request data as a byte array.
144 // /// </summary>
145 // /// <param name="count">How many bytes.</param>
146 // /// <returns></returns>
147 // byte[] BinaryRead(int count);
149 /// <summary>
150 /// Reads the cookie.
151 /// </summary>
152 /// <param name="name">The cookie name.</param>
153 /// <returns></returns>
154 String ReadCookie(String name);
156 /// <summary>
157 /// Gets the user languages.
158 /// </summary>
159 /// <value>The user languages.</value>
160 String[] UserLanguages { get; }
162 /// <summary>
163 /// Gets the IP host address of the remote client.
164 /// </summary>
165 /// <value>The IP address of the remote client.</value>
166 string UserHostAddress { get; }
168 /// <summary>
169 /// Lazy initialized property with a hierarchical
170 /// representation of the flat data on <see cref="Controller.Params"/>
171 /// </summary>
172 CompositeNode ParamsNode { get; }
174 /// <summary>
175 /// Lazy initialized property with a hierarchical
176 /// representation of the flat data on <see cref="IRequest.Form"/>
177 /// </summary>
178 CompositeNode FormNode { get; }
180 /// <summary>
181 /// Lazy initialized property with a hierarchical
182 /// representation of the flat data on <see cref="IRequest.QueryString"/>
183 /// </summary>
184 /// <value>The query string node.</value>
185 CompositeNode QueryStringNode { get; }
187 /// <summary>
188 /// Obtains the params node.
189 /// </summary>
190 /// <param name="from">From.</param>
191 /// <returns></returns>
192 CompositeNode ObtainParamsNode(ParamStore from);
194 /// <summary>
195 /// Validates the input.
196 /// </summary>
197 void ValidateInput();