1 // Copyright 2004-2008 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
;
21 using Castle
.Components
.Binder
;
24 /// Defines where the parameters should be obtained from
26 public enum ParamStore
33 /// Only from the Form
37 /// From QueryString, Form and Environment variables.
43 /// Represents the request data
45 public interface IRequest
48 /// Gets the accept header.
50 /// <value>The accept header.</value>
51 string AcceptHeader { get; }
54 /// Gets the request type (GET, POST, etc)
56 [Obsolete("Use the property HttpMethod instead")]
57 String RequestType { get; }
60 /// Gets additional path information for
61 /// a resource with a URL extension.
63 /// <value>The path info.</value>
64 String PathInfo { get; }
69 /// <value>The raw URL.</value>
70 [Obsolete("Use the property Url instead")]
71 String RawUrl { get; }
76 /// <value>The URI.</value>
80 /// Gets the request URL.
85 /// Gets the referring URL.
87 String UrlReferrer { get; }
90 /// Gets the <see cref="HttpPostedFile"/> per key.
92 IDictionary Files { get; }
95 /// Gets the params which accumulates headers, post, querystring and cookies.
97 /// <value>The params.</value>
98 NameValueCollection Params { get; }
101 /// Gets the query string.
103 /// <value>The query string.</value>
104 NameValueCollection QueryString { get; }
109 /// <value>The form.</value>
110 NameValueCollection Form { get; }
113 /// Gets the Http headers.
115 /// <value>The Http headers.</value>
116 NameValueCollection Headers { get; }
119 /// Indexer to access <see cref="Params"/> entries.
122 string this[string name
] { get; }
125 /// Gets a value indicating whether this requeest is from a local address.
127 /// <value><c>true</c> if this instance is local; otherwise, <c>false</c>.</value>
128 bool IsLocal { get; }
131 /// Gets the HTTP method.
133 /// <value>The HTTP method.</value>
134 String HttpMethod { get; }
137 /// Gets the file path.
139 /// <value>The file path.</value>
140 String FilePath { get; }
143 // /// Reads the request data as a byte array.
145 // /// <param name="count">How many bytes.</param>
146 // /// <returns></returns>
147 // byte[] BinaryRead(int count);
150 /// Reads the cookie.
152 /// <param name="name">The cookie name.</param>
153 /// <returns></returns>
154 String
ReadCookie(String name
);
157 /// Gets the user languages.
159 /// <value>The user languages.</value>
160 String
[] UserLanguages { get; }
163 /// Gets the IP host address of the remote client.
165 /// <value>The IP address of the remote client.</value>
166 string UserHostAddress { get; }
169 /// Lazy initialized property with a hierarchical
170 /// representation of the flat data on <see cref="Controller.Params"/>
172 CompositeNode ParamsNode { get; }
175 /// Lazy initialized property with a hierarchical
176 /// representation of the flat data on <see cref="IRequest.Form"/>
178 CompositeNode FormNode { get; }
181 /// Lazy initialized property with a hierarchical
182 /// representation of the flat data on <see cref="IRequest.QueryString"/>
184 /// <value>The query string node.</value>
185 CompositeNode QueryStringNode { get; }
188 /// Obtains the params node.
190 /// <param name="from">From.</param>
191 /// <returns></returns>
192 CompositeNode
ObtainParamsNode(ParamStore
from);
195 /// Validates the input.
197 void ValidateInput();