HttpResponseWrapper.cs 8.1 KB

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