2002-04-11 Patrik Torstensson <patrik.torstensson@labs2.com>
[mono.git] / mcs / class / System.Web / System.Web / HttpApplication.cs
index 7446a591bdb178688106d014e3890299295214b0..21a20a1c1d6d621cc0e931949f9a0e0b5cbe57e9 100644 (file)
 //   Patrik Torstensson (Patrik.Torstensson@labs2.com)\r
 //\r
 using System;\r
+using System.ComponentModel;\r
 \r
 namespace System.Web {\r
    [MonoTODO()]\r
-   public class HttpApplication {\r
+   public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable {\r
+      private bool _CompleteRequest;\r
+\r
+      private HttpContext _Context;\r
+      private HttpContext _OverrideContext;\r
+         \r
+      private bool _InPreRequestResponseMode;\r
+\r
+      private ISite _Site;\r
+      private HttpModuleCollection _ModuleCollection;\r
+      private HttpSessionState _Session;\r
+\r
+      public event EventHandler AcquireRequestState;\r
+      public event EventHandler AuthenticateRequest;\r
+      public event EventHandler AuthorizeRequest;\r
+      public event EventHandler BeginRequest;\r
+      public event EventHandler Disposed;\r
+      public event EventHandler EndRequest;\r
+      public event EventHandler Error;\r
+      public event EventHandler PostRequestHandlerExecute;\r
+      public event EventHandler PreRequestHandlerExecute;\r
+      public event EventHandler PreSendRequestContent;\r
+      public event EventHandler PreSendRequestHeaders;\r
+      public event EventHandler ReleaseRequestState;\r
+      public event EventHandler ResolveRequestCache;\r
+      public event EventHandler UpdateRequestCache;\r
+\r
+      [MonoTODO()]\r
       public HttpApplication() {\r
-         //\r
-         // TODO: Add constructor logic here\r
-         //\r
+         // Init HTTP context and the methods from HttpRuntime....\r
+      }\r
+\r
+      internal void ClearError() {\r
+         // Called from Server Utility\r
+      }\r
+\r
+      public HttpContext Context {\r
+         get {\r
+            if (null != _OverrideContext) {\r
+               return _OverrideContext;\r
+            }\r
+\r
+            return _Context;\r
+         }\r
+      }\r
+\r
+      public HttpModuleCollection Modules {\r
+         get {\r
+            if (null == _ModuleCollection) {\r
+               _ModuleCollection = new HttpModuleCollection();\r
+            }\r
+\r
+            return _ModuleCollection;\r
+         }\r
+      }\r
+\r
+      public HttpRequest Request {\r
+         get {\r
+            if (null != _Context && (!_InPreRequestResponseMode)) {\r
+               return _Context.Request;\r
+            }\r
+\r
+            throw new HttpException("Cant get request object");\r
+         }\r
+      }\r
+\r
+      public HttpResponse Response {\r
+         get {\r
+            if (null != _Context && (!_InPreRequestResponseMode)) {\r
+               return _Context.Response;\r
+            }\r
+\r
+            throw new HttpException("Cant get response object");\r
+         }\r
+      }\r
+\r
+      public HttpServerUtility Server {\r
+         get {\r
+            if (null != _Context) {\r
+               return _Context.Server;\r
+            }\r
+\r
+            return new HttpServerUtility(this);\r
+         }\r
+      }\r
+\r
+      public HttpSessionState Session {\r
+         get {\r
+            if (null != _Session) {\r
+               return _Session;\r
+            }\r
+\r
+            if (null != _Context && null != _Context.Session) {\r
+               return _Context.Session;\r
+            }\r
+\r
+            throw new HttpException("Failed to get session object");\r
+         }\r
+      }\r
+\r
+      public virtual string GetVaryByCustomString(HttpContext context, string custom) {\r
+         if (custom.ToLower() == "browser") {\r
+            return context.Request.Browser.Type;\r
+         }\r
+\r
+         return string.Empty;\r
+      }\r
+\r
+      [MonoTODO()]\r
+      IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      void IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      [MonoTODO()]\r
+      void IHttpHandler.ProcessRequest(HttpContext context) {\r
+         throw new NotImplementedException();\r
+      }\r
+\r
+      bool IHttpHandler.IsReusable {\r
+         get {\r
+            throw new NotImplementedException();\r
+         }\r
+      }\r
+\r
+      public ISite Site {\r
+         get {\r
+            return _Site;\r
+         }\r
+\r
+         set {\r
+            _Site = value;\r
+         }\r
+      }\r
+\r
+      public void CompleteRequest() {\r
+         _CompleteRequest = true;\r
+      }\r
+\r
+      [MonoTODO("Cleanup")]\r
+      public virtual void Dispose() {\r
+         \r
+      }\r
+\r
+      public virtual void Init() {\r
       }\r
    }\r
 }\r