[corlib] Use ManualResetEvent.WaitOne instead of Thread.Sleep to test Thread.Interrupt
[mono.git] / mcs / class / System.Web.Abstractions / System.Web / HttpContextWrapper.cs
1 //
2 // HttpContextWrapper.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2008-2010 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.Globalization;
34 using System.Runtime.CompilerServices;
35 using System.Security.Permissions;
36 using System.Security.Principal;
37 using System.Web.Caching;
38 using System.Web.Profile;
39 using System.Web.SessionState;
40
41 namespace System.Web
42 {
43         [TypeForwardedFrom ("System.Web.Abstractions, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
44         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
45         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
46         public class HttpContextWrapper : HttpContextBase
47         {
48                 HttpContext w;
49
50                 public HttpContextWrapper (HttpContext httpContext)
51                 {
52                         if (httpContext == null)
53                                 throw new ArgumentNullException ("httpContext");
54                         w = httpContext;
55                 }
56
57                 public override Exception [] AllErrors {
58                         get { return w.AllErrors; }
59                 }
60
61                 public override HttpApplicationStateBase Application {
62                         get { return new HttpApplicationStateWrapper (w.Application); }
63                 }
64
65                 public override HttpApplication ApplicationInstance {
66                         get { return w.ApplicationInstance; }
67                         set { w.ApplicationInstance = value; }
68                 }
69
70                 public override Cache Cache {
71                         get { return w.Cache; }
72                 }
73
74                 public override IHttpHandler CurrentHandler {
75                         get { return w.CurrentHandler; }
76                 }
77
78                 public override RequestNotification CurrentNotification {
79                         get { return w.CurrentNotification; }
80                 }
81
82                 public override Exception Error {
83                         get { return w.Error; }
84                 }
85
86                 public override IHttpHandler Handler {
87                         get { return w.Handler; }
88                         set { w.Handler = value; }
89                 }
90
91                 public override bool IsCustomErrorEnabled {
92                         get { return w.IsCustomErrorEnabled; }
93                 }
94
95                 public override bool IsDebuggingEnabled {
96                         get { return w.IsDebuggingEnabled; }
97                 }
98
99                 public override bool IsPostNotification {
100                         get { return w.IsPostNotification; }
101                 }
102
103                 public override IDictionary Items {
104                         get { return w.Items; }
105                 }
106
107                 public override IHttpHandler PreviousHandler {
108                         get { return w.PreviousHandler; }
109                 }
110
111                 public override ProfileBase Profile {
112                         get { return w.Profile; }
113                 }
114
115                 public override HttpRequestBase Request {
116                         get { return new HttpRequestWrapper (w.Request); }
117                 }
118
119                 public override HttpResponseBase Response {
120                         get { return new HttpResponseWrapper (w.Response); }
121                 }
122
123                 public override HttpServerUtilityBase Server {
124                         get { return new HttpServerUtilityWrapper (w.Server); }
125                 }
126
127                 public override HttpSessionStateBase Session {
128                         get { return w.Session == null ? null : new HttpSessionStateWrapper (w.Session); }
129                 }
130
131                 public override bool SkipAuthorization {
132                         get { return w.SkipAuthorization; }
133                         set { w.SkipAuthorization = value; }
134                 }
135
136                 public override DateTime Timestamp {
137                         get { return w.Timestamp; }
138                 }
139
140                 public override TraceContext Trace {
141                         get { return w.Trace; }
142                 }
143
144                 public override IPrincipal User {
145                         get { return w.User; }
146                         set { w.User = value; }
147                 }
148
149                 public override void AddError (Exception errorInfo)
150                 {
151                         w.AddError (errorInfo);
152                 }
153
154                 public override void ClearError ()
155                 {
156                         w.ClearError ();
157                 }
158
159                 public override object GetGlobalResourceObject (string classKey, string resourceKey)
160                 {
161                         return HttpContext.GetGlobalResourceObject (classKey, resourceKey);
162                 }
163
164                 public override object GetGlobalResourceObject (string classKey, string resourceKey, CultureInfo culture)
165                 {
166                         return HttpContext.GetGlobalResourceObject (classKey, resourceKey, culture);
167                 }
168
169                 public override object GetLocalResourceObject (string overridePath, string resourceKey)
170                 {
171                         return HttpContext.GetLocalResourceObject (overridePath, resourceKey);
172                 }
173
174                 public override object GetLocalResourceObject (string overridePath, string resourceKey, CultureInfo culture)
175                 {
176                         return HttpContext.GetLocalResourceObject (overridePath, resourceKey, culture);
177                 }
178
179                 public override object GetSection (string sectionName)
180                 {
181                         return w.GetSection (sectionName);
182                 }
183
184                 public override object GetService (Type serviceType)
185                 {
186                         return ((IServiceProvider)w).GetService (serviceType);
187                 }
188                 public override void RemapHandler (IHttpHandler handler)
189                 {
190                         w.RemapHandler (handler);
191                 }
192                 public override void RewritePath (string path)
193                 {
194                         w.RewritePath (path);
195                 }
196
197                 public override void RewritePath (string path, bool rebaseClientPath)
198                 {
199                         w.RewritePath (path, rebaseClientPath);
200                 }
201
202                 public override void RewritePath (string filePath, string pathInfo, string queryString)
203                 {
204                         w.RewritePath (filePath, pathInfo, queryString);
205                 }
206
207                 public override void RewritePath (string filePath, string pathInfo, string queryString, bool setClientFilePath)
208                 {
209                         w.RewritePath (filePath, pathInfo, queryString, setClientFilePath);
210                 }
211                 public override void SetSessionStateBehavior (SessionStateBehavior sessionStateBehavior)
212                 {
213                         w.SetSessionStateBehavior (sessionStateBehavior);
214                 }
215         }
216 }