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
;
23 /// Represents the response data and operations
25 public interface IResponse
28 /// Gets or sets the status code.
30 /// <value>The status code.</value>
31 int StatusCode { get; set; }
34 /// Gets or sets the status code.
36 /// <value>The status code.</value>
37 string StatusDescription { get; set; }
40 /// Gets or sets the type of the content.
42 /// <value>The type of the content.</value>
43 string ContentType { get; set; }
46 /// Gets the caching policy (expiration time, privacy,
47 /// vary clauses) of a Web page.
49 HttpCachePolicy CachePolicy { get; }
52 /// Sets the Cache-Control HTTP header to Public or Private.
54 String CacheControlHeader { get; set; }
57 /// Gets or sets the HTTP character set of the output stream.
59 String Charset { get; set; }
64 /// <value>The output.</value>
65 System
.IO
.TextWriter Output { get; }
68 /// Gets the output stream.
70 /// <value>The output stream.</value>
71 System
.IO
.Stream OutputStream { get; }
74 /// Appends the header.
76 /// <param name="name">The name.</param>
77 /// <param name="value">The value.</param>
78 void AppendHeader(String name
, String
value);
81 // /// Writes the buffer to the browser
83 // /// <param name="buffer">The buffer.</param>
84 // void BinaryWrite(byte[] buffer);
87 // /// Writes the stream to the browser
89 // /// <param name="stream">The stream.</param>
90 // void BinaryWrite(System.IO.Stream stream);
93 /// Clears the response (only works if buffered)
98 /// Clears the response content (only works if buffered).
103 /// Writes the specified string.
105 /// <param name="s">The string.</param>
106 void Write(String s
);
109 /// Writes the specified obj.
111 /// <param name="obj">The obj.</param>
112 void Write(object obj
);
115 /// Writes the specified char.
117 /// <param name="ch">The char.</param>
121 /// Writes the specified buffer.
123 /// <param name="buffer">The buffer.</param>
124 /// <param name="index">The index.</param>
125 /// <param name="count">The count.</param>
126 void Write(char[] buffer
, int index
, int count
);
129 // /// Writes the file.
131 // /// <param name="fileName">Name of the file.</param>
132 // void WriteFile(String fileName);
135 /// Redirects the specified controller.
137 /// <param name="parameters">The parameters.</param>
138 void Redirect(object parameters
);
141 /// Redirects the specified controller.
143 /// <param name="controller">The controller.</param>
144 /// <param name="action">The action.</param>
145 void Redirect(String controller
, String action
);
148 /// Redirects the specified area.
150 /// <param name="area">The area.</param>
151 /// <param name="controller">The controller.</param>
152 /// <param name="action">The action.</param>
153 void Redirect(String area
, String controller
, String action
);
156 /// Redirects to another controller and action with the specified paramters.
158 /// <param name="controller">Controller name</param>
159 /// <param name="action">Action name</param>
160 /// <param name="parameters">Key/value pairings</param>
161 void Redirect(string controller
, string action
, NameValueCollection parameters
);
164 /// Redirects to another controller and action with the specified paramters.
166 /// <param name="area">Area name</param>
167 /// <param name="controller">Controller name</param>
168 /// <param name="action">Action name</param>
169 /// <param name="parameters">Key/value pairings</param>
170 void Redirect(string area
, string controller
, string action
, NameValueCollection parameters
);
173 /// Redirects to another controller and action with the specified paramters.
175 /// <param name="controller">Controller name</param>
176 /// <param name="action">Action name</param>
177 /// <param name="parameters">Key/value pairings</param>
178 void Redirect(string controller
, string action
, IDictionary parameters
);
181 /// Redirects to another controller and action with the specified paramters.
183 /// <param name="area">Area name</param>
184 /// <param name="controller">Controller name</param>
185 /// <param name="action">Action name</param>
186 /// <param name="parameters">Key/value pairings</param>
187 void Redirect(string area
, string controller
, string action
, IDictionary parameters
);
190 /// Redirects the specified URL.
192 /// <param name="url">The URL.</param>
193 void RedirectToUrl(String url
);
196 /// Redirects the specified URL.
198 /// <param name="url">The URL.</param>
199 /// <param name="endProcess">if set to <c>true</c> [end process].</param>
200 void RedirectToUrl(String url
, bool endProcess
);
203 /// Gets a value indicating whether the response sent a redirect.
205 /// <value><c>true</c> if was redirected; otherwise, <c>false</c>.</value>
206 bool WasRedirected { get; }
209 /// Gets a value indicating whether this instance is client connected.
212 /// <c>true</c> if this instance is client connected; otherwise, <c>false</c>.
214 bool IsClientConnected { get; }
217 /// Creates a cookie.
219 /// <param name="name">The name.</param>
220 /// <param name="value">The value.</param>
221 void CreateCookie(String name
, String
value);
224 /// Creates a cookie.
226 /// <param name="name">The name.</param>
227 /// <param name="value">The value.</param>
228 /// <param name="expiration">The expiration.</param>
229 void CreateCookie(String name
, String
value, DateTime expiration
);
232 /// Creates a cookie.
234 /// <param name="cookie">The cookie.</param>
235 void CreateCookie(HttpCookie cookie
);
238 /// Removes a cookie.
240 /// <param name="name">The name.</param>
241 void RemoveCookie(string name
);