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
21 /// Represents the response data and operations
23 public interface IResponse
: IRedirectSupport
26 /// Gets or sets the status code.
28 /// <value>The status code.</value>
29 int StatusCode { get; set; }
32 /// Gets or sets the status code.
34 /// <value>The status code.</value>
35 string StatusDescription { get; set; }
38 /// Gets or sets the type of the content.
40 /// <value>The type of the content.</value>
41 string ContentType { get; set; }
44 /// Gets the caching policy (expiration time, privacy,
45 /// vary clauses) of a Web page.
47 HttpCachePolicy CachePolicy { get; }
50 /// Sets the Cache-Control HTTP header to Public or Private.
52 string CacheControlHeader { get; set; }
55 /// Gets or sets the HTTP character set of the output stream.
57 string Charset { get; set; }
62 /// <value>The output.</value>
63 System
.IO
.TextWriter Output { get; }
66 /// Gets the output stream.
68 /// <value>The output stream.</value>
69 System
.IO
.Stream OutputStream { get; }
72 /// Appends the header.
74 /// <param name="name">The name.</param>
75 /// <param name="value">The value.</param>
76 void AppendHeader(string name
, string value);
79 /// Writes the buffer to the browser
81 /// <param name="buffer">The buffer.</param>
82 void BinaryWrite(byte[] buffer
);
85 /// Writes the stream to the browser
87 /// <param name="stream">The stream.</param>
88 void BinaryWrite(System
.IO
.Stream stream
);
91 /// Clears the response (only works if buffered)
96 /// Clears the response content (only works if buffered).
101 /// Writes the specified string.
103 /// <param name="s">The string.</param>
104 void Write(string s
);
107 /// Writes the specified obj.
109 /// <param name="obj">The obj.</param>
110 void Write(object obj
);
113 /// Writes the specified char.
115 /// <param name="ch">The char.</param>
119 /// Writes the specified buffer.
121 /// <param name="buffer">The buffer.</param>
122 /// <param name="index">The index.</param>
123 /// <param name="count">The count.</param>
124 void Write(char[] buffer
, int index
, int count
);
129 /// <param name="fileName">Name of the file.</param>
130 void WriteFile(string fileName
);
133 /// Gets a value indicating whether the response sent a redirect.
135 /// <value><c>true</c> if was redirected; otherwise, <c>false</c>.</value>
136 bool WasRedirected { get; }
139 /// Gets a value indicating whether this instance is client connected.
142 /// <c>true</c> if this instance is client connected; otherwise, <c>false</c>.
144 bool IsClientConnected { get; }
147 /// Creates a cookie.
149 /// <param name="name">The name.</param>
150 /// <param name="value">The value.</param>
151 void CreateCookie(string name
, string value);
154 /// Creates a cookie.
156 /// <param name="name">The name.</param>
157 /// <param name="value">The value.</param>
158 /// <param name="expiration">The expiration.</param>
159 void CreateCookie(string name
, string value, DateTime expiration
);
162 /// Creates a cookie.
164 /// <param name="cookie">The cookie.</param>
165 void CreateCookie(HttpCookie cookie
);
168 /// Removes a cookie.
170 /// <param name="name">The name.</param>
171 void RemoveCookie(string name
);