Beispiel #1
0
        static void Process(HttpWorkerRequest req)
        {
            bool error = false;

#if TARGET_J2EE
            HttpContext context = HttpContext.Current;
            if (context == null)
            {
                context = new HttpContext(req);
            }
            else
            {
                context.SetWorkerRequest(req);
            }
#else
            if (firstRun)
            {
                firstRun = false;
                if (initialException != null)
                {
                    FinishWithException(req, HttpException.NewWithCode("Initial exception", initialException, WebEventCodes.RuntimeErrorRequestAbort));
                    error = true;
                }
                SetupOfflineWatch();
            }
            HttpContext context = new HttpContext(req);
#endif
            HttpContext.Current = context;
#if !TARGET_J2EE
            if (AppIsOffline(context))
            {
                return;
            }
#endif

            //
            // Get application instance (create or reuse an instance of the correct class)
            //
            HttpApplication app = null;
            if (!error)
            {
                try {
                    app = HttpApplicationFactory.GetApplication(context);
                } catch (Exception e) {
                    FinishWithException(req, HttpException.NewWithCode(String.Empty, e, WebEventCodes.RuntimeErrorRequestAbort));
                    error = true;
                }
            }

            if (error)
            {
                context.Request.ReleaseResources();
                context.Response.ReleaseResources();
                HttpContext.Current = null;
            }
            else
            {
                context.ApplicationInstance = app;
                req.SetEndOfSendNotification(end_of_send_cb, context);

                //
                // Ask application to service the request
                //

#if TARGET_J2EE
                IHttpAsyncHandler ihah = app;
                if (context.Handler == null)
                {
                    ihah.BeginProcessRequest(context, new AsyncCallback(request_processed), context);
                }
                else
                {
                    app.Tick();
                }
                //ihh.ProcessRequest (context);
                IHttpExtendedHandler extHandler = context.Handler as IHttpExtendedHandler;
                if (extHandler != null && !extHandler.IsCompleted)
                {
                    return;
                }
                if (context.Error is UnifyRequestException)
                {
                    return;
                }

                ihah.EndProcessRequest(null);
#else
                IHttpHandler ihh = app;
//				IAsyncResult appiar = ihah.BeginProcessRequest (context, new AsyncCallback (request_processed), context);
//				ihah.EndProcessRequest (appiar);
                ihh.ProcessRequest(context);
#endif

                HttpApplicationFactory.Recycle(app);
            }
        }
			public ReadOnlySessionWrapperExtendedHandler (IHttpExtendedHandler handler) : base (handler) { }
Beispiel #3
0
 public ReadOnlySessionWrapperExtendedHandler(IHttpExtendedHandler handler) : base(handler)
 {
 }