Add ClientDisconnectedToken property to HttpResponseBase and Wrapper as default None
[mono.git] / mcs / class / System.Web.Abstractions / System.Web / HttpResponseWrapper.cs
1 //
2 // HttpResponseWrapper.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2008 Novell Inc. http://novell.com
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 using System;
31 using System.Collections;
32 using System.Collections.Generic;
33 using System.Collections.Specialized;
34 using System.Globalization;
35 using System.IO;
36 using System.Runtime.CompilerServices;
37 using System.Runtime.Serialization;
38 using System.Security.Permissions;
39 using System.Security.Principal;
40 using System.Text;
41 using System.Web.Caching;
42 using System.Threading;
43
44 namespace System.Web
45 {
46 #if NET_4_0
47         [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
48 #endif
49         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
50         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
51         public class HttpResponseWrapper : HttpResponseBase
52         {
53                 HttpResponse w;
54
55                 public HttpResponseWrapper (HttpResponse httpResponse)
56                 {
57                         if (httpResponse == null)
58                                 throw new ArgumentNullException ("httpResponse");
59                         w = httpResponse;
60                 }
61
62                 public override bool Buffer {
63                         get { return w.Buffer; }
64                         set { w.Buffer = value; }
65                 }
66
67                 public override bool BufferOutput {
68                         get { return w.BufferOutput; }
69                         set { w.BufferOutput = value; }
70                 }
71
72                 public override HttpCachePolicyBase Cache {
73                         get { return new HttpCachePolicyWrapper (w.Cache); }
74                 }
75
76                 public override string CacheControl {
77                         get { return w.CacheControl; }
78                         set { w.CacheControl = value; }
79                 }
80
81                 public override string Charset {
82                         get { return w.Charset; }
83                         set { w.Charset = value; }
84                 }
85
86 #if NET_4_5
87                 public override CancellationToken ClientDisconnectedToken {
88                         get { return CancellationToken.None; }
89                 }
90 #endif
91
92                 public override Encoding ContentEncoding {
93                         get { return w.ContentEncoding; }
94                         set { w.ContentEncoding = value; }
95                 }
96
97                 public override string ContentType {
98                         get { return w.ContentType; }
99                         set { w.ContentType = value; }
100                 }
101
102                 public override HttpCookieCollection Cookies {
103                         get { return w.Cookies; }
104                 }
105
106                 public override int Expires {
107                         get { return w.Expires; }
108                         set { w.Expires = value; }
109                 }
110
111                 public override DateTime ExpiresAbsolute {
112                         get { return w.ExpiresAbsolute; }
113                         set { w.ExpiresAbsolute = value; }
114                 }
115
116                 public override Stream Filter {
117                         get { return w.Filter; }
118                         set { w.Filter = value; }
119                 }
120
121                 public override Encoding HeaderEncoding {
122                         get { return w.HeaderEncoding; }
123                         set { w.HeaderEncoding = value; }
124                 }
125
126                 public override NameValueCollection Headers {
127                         get { return w.Headers; }
128                 }
129
130                 public override bool IsClientConnected {
131                         get { return w.IsClientConnected; }
132                 }
133
134                 public override bool IsRequestBeingRedirected {
135                         get { return w.IsRequestBeingRedirected; }
136                 }
137
138                 public override TextWriter Output {
139                         get { return w.Output; }
140 #if NET_4_0
141                         set { w.Output = value; }
142 #endif
143                 }
144
145                 public override Stream OutputStream {
146                         get { return w.OutputStream; }
147                 }
148
149                 public override string RedirectLocation {
150                         get { return w.RedirectLocation; }
151                         set { w.RedirectLocation = value; }
152                 }
153
154                 public override string Status {
155                         get { return w.Status; }
156                         set { w.Status = value; }
157                 }
158
159                 public override int StatusCode {
160                         get { return w.StatusCode; }
161                         set { w.StatusCode = value; }
162                 }
163
164                 public override string StatusDescription {
165                         get { return w.StatusDescription; }
166                         set { w.StatusDescription = value; }
167                 }
168
169                 public override int SubStatusCode {
170                         get { return w.SubStatusCode; }
171                         set { w.SubStatusCode = value; }
172                 }
173
174                 public override bool SuppressContent {
175                         get { return w.SuppressContent; }
176                         set { w.SuppressContent = value; }
177                 }
178
179                 public override bool TrySkipIisCustomErrors {
180                         get { return w.TrySkipIisCustomErrors; }
181                         set { w.TrySkipIisCustomErrors = value; }
182                 }
183
184                 public override void AddCacheDependency (params CacheDependency [] dependencies)
185                 {
186                         w.AddCacheDependency (dependencies);
187                 }
188
189                 public override void AddCacheItemDependencies (ArrayList cacheKeys)
190                 {
191                         w.AddCacheItemDependencies (cacheKeys);
192                 }
193
194                 public override void AddCacheItemDependencies (string [] cacheKeys)
195                 {
196                         w.AddCacheItemDependencies (cacheKeys);
197                 }
198
199                 public override void AddCacheItemDependency (string cacheKey)
200                 {
201                         w.AddCacheItemDependency (cacheKey);
202                 }
203
204                 public override void AddFileDependencies (ArrayList filenames)
205                 {
206                         w.AddFileDependencies (filenames);
207                 }
208
209                 public override void AddFileDependencies (string [] filenames)
210                 {
211                         w.AddFileDependencies (filenames);
212                 }
213
214                 public override void AddFileDependency (string filename)
215                 {
216                         w.AddFileDependency (filename);
217                 }
218
219                 public override void AddHeader (string name, string value)
220                 {
221                         w.AddHeader (name, value);
222                 }
223
224                 public override void AppendCookie (HttpCookie cookie)
225                 {
226                         w.AppendCookie (cookie);
227                 }
228
229                 public override void AppendHeader (string name, string value)
230                 {
231                         w.AppendHeader (name, value);
232                 }
233
234                 public override void AppendToLog (string param)
235                 {
236                         w.AppendToLog (param);
237                 }
238
239                 public override string ApplyAppPathModifier (string overridePath)
240                 {
241                         return w.ApplyAppPathModifier (overridePath);
242                 }
243
244                 public override void BinaryWrite (byte [] buffer)
245                 {
246                         w.BinaryWrite (buffer);
247                 }
248
249                 public override void Clear ()
250                 {
251                         w.Clear ();
252                 }
253
254                 public override void ClearContent ()
255                 {
256                         w.ClearContent ();
257                 }
258
259                 public override void ClearHeaders ()
260                 {
261                         w.ClearHeaders ();
262                 }
263
264                 public override void Close ()
265                 {
266                         w.Close ();
267                 }
268
269                 public override void DisableKernelCache ()
270                 {
271                          w.DisableKernelCache ();
272                 }
273
274                 public override void End ()
275                 {
276                         w.End ();
277                 }
278
279                 public override void Flush ()
280                 {
281                         w.Flush ();
282                 }
283
284                 public override void Pics (string value)
285                 {
286                         w.Pics (value);
287                 }
288
289                 public override void Redirect (string url)
290                 {
291                         w.Redirect (url);
292                 }
293
294                 public override void Redirect (string url, bool endResponse)
295                 {
296                         w.Redirect (url, endResponse);
297                 }
298 #if NET_4_0
299                 public override void RedirectPermanent (string url)
300                 {
301                         w.RedirectPermanent (url);
302                 }
303
304                 public override void RedirectPermanent (string url, bool endResponse)
305                 {
306                         w.RedirectPermanent (url, endResponse);
307                 }
308
309                 public override void RemoveOutputCacheItem (string path, string providerName)
310                 {
311                         HttpResponse.RemoveOutputCacheItem (path, providerName);
312                 }
313 #endif
314                 public override void RemoveOutputCacheItem (string path)
315                 {
316                          HttpResponse.RemoveOutputCacheItem (path);
317                 }
318
319                 public override void SetCookie (HttpCookie cookie)
320                 {
321                         w.SetCookie (cookie);
322                 }
323
324                 public override void TransmitFile (string filename)
325                 {
326                         w.TransmitFile (filename);
327                 }
328
329                 public override void TransmitFile (string filename, long offset, long length)
330                 {
331                         w.TransmitFile (filename, offset, length);
332                 }
333
334                 public override void Write (char ch)
335                 {
336                         w.Write (ch);
337                 }
338
339                 public override void Write (object obj)
340                 {
341                         w.Write (obj);
342                 }
343
344                 public override void Write (string s)
345                 {
346                         w.Write (s);
347                 }
348
349                 public override void Write (char [] buffer, int index, int count)
350                 {
351                         w.Write (buffer, index, count);
352                 }
353
354                 public override void WriteFile (string filename)
355                 {
356                         w.WriteFile (filename);
357                 }
358
359                 public override void WriteFile (string filename, bool readIntoMemory)
360                 {
361                         w.WriteFile (filename, readIntoMemory);
362                 }
363
364                 public override void WriteFile (IntPtr fileHandle, long offset, long size)
365                 {
366                         w.WriteFile (fileHandle, offset, size);
367                 }
368
369                 public override void WriteFile (string filename, long offset, long size)
370                 {
371                         w.WriteFile (filename, offset, size);
372                 }
373
374                 public override void WriteSubstitution (HttpResponseSubstitutionCallback callback)
375                 {
376                         w.WriteSubstitution (callback);
377                 }
378         }
379 }