More working tests.
[castle.git] / MonoRail / Castle.MonoRail.Framework / IResponse.cs
blob2895291916b99d2ec563ed523eb942e3c05d01e9
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.Web;
20 /// <summary>
21 /// Represents the response data and operations
22 /// </summary>
23 public interface IResponse : IRedirectSupport
25 /// <summary>
26 /// Gets or sets the status code.
27 /// </summary>
28 /// <value>The status code.</value>
29 int StatusCode { get; set; }
31 /// <summary>
32 /// Gets or sets the status code.
33 /// </summary>
34 /// <value>The status code.</value>
35 string StatusDescription { get; set; }
37 /// <summary>
38 /// Gets or sets the type of the content.
39 /// </summary>
40 /// <value>The type of the content.</value>
41 string ContentType { get; set; }
43 /// <summary>
44 /// Gets the caching policy (expiration time, privacy,
45 /// vary clauses) of a Web page.
46 /// </summary>
47 HttpCachePolicy CachePolicy { get; }
49 /// <summary>
50 /// Sets the Cache-Control HTTP header to Public or Private.
51 /// </summary>
52 string CacheControlHeader { get; set; }
54 /// <summary>
55 /// Gets or sets the HTTP character set of the output stream.
56 /// </summary>
57 string Charset { get; set; }
59 /// <summary>
60 /// Gets the output.
61 /// </summary>
62 /// <value>The output.</value>
63 System.IO.TextWriter Output { get; }
65 /// <summary>
66 /// Gets the output stream.
67 /// </summary>
68 /// <value>The output stream.</value>
69 System.IO.Stream OutputStream { get; }
71 /// <summary>
72 /// Appends the header.
73 /// </summary>
74 /// <param name="name">The name.</param>
75 /// <param name="value">The value.</param>
76 void AppendHeader(string name, string value);
78 /// <summary>
79 /// Writes the buffer to the browser
80 /// </summary>
81 /// <param name="buffer">The buffer.</param>
82 void BinaryWrite(byte[] buffer);
84 /// <summary>
85 /// Writes the stream to the browser
86 /// </summary>
87 /// <param name="stream">The stream.</param>
88 void BinaryWrite(System.IO.Stream stream);
90 /// <summary>
91 /// Clears the response (only works if buffered)
92 /// </summary>
93 void Clear();
95 /// <summary>
96 /// Clears the response content (only works if buffered).
97 /// </summary>
98 void ClearContent();
100 /// <summary>
101 /// Writes the specified string.
102 /// </summary>
103 /// <param name="s">The string.</param>
104 void Write(string s);
106 /// <summary>
107 /// Writes the specified obj.
108 /// </summary>
109 /// <param name="obj">The obj.</param>
110 void Write(object obj);
112 /// <summary>
113 /// Writes the specified char.
114 /// </summary>
115 /// <param name="ch">The char.</param>
116 void Write(char ch);
118 /// <summary>
119 /// Writes the specified buffer.
120 /// </summary>
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);
126 /// <summary>
127 /// Writes the file.
128 /// </summary>
129 /// <param name="fileName">Name of the file.</param>
130 void WriteFile(string fileName);
132 /// <summary>
133 /// Gets a value indicating whether the response sent a redirect.
134 /// </summary>
135 /// <value><c>true</c> if was redirected; otherwise, <c>false</c>.</value>
136 bool WasRedirected { get; }
138 /// <summary>
139 /// Gets a value indicating whether this instance is client connected.
140 /// </summary>
141 /// <value>
142 /// <c>true</c> if this instance is client connected; otherwise, <c>false</c>.
143 /// </value>
144 bool IsClientConnected { get; }
146 /// <summary>
147 /// Creates a cookie.
148 /// </summary>
149 /// <param name="name">The name.</param>
150 /// <param name="value">The value.</param>
151 void CreateCookie(string name, string value);
153 /// <summary>
154 /// Creates a cookie.
155 /// </summary>
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);
161 /// <summary>
162 /// Creates a cookie.
163 /// </summary>
164 /// <param name="cookie">The cookie.</param>
165 void CreateCookie(HttpCookie cookie);
167 /// <summary>
168 /// Removes a cookie.
169 /// </summary>
170 /// <param name="name">The name.</param>
171 void RemoveCookie(string name);