internal void CreateExecutionSteps(NetHttpApplication app, ArrayList steps) { for (int i = 0; i < _count; i++) { steps.Add(new AsyncEventExecutionStep(app, (BeginEventHandler)_beginHandlers[i], (EndEventHandler)_endHandlers[i], _stateObjects[i])); } }
internal AsyncEventExecutionStep(NetHttpApplication app, BeginEventHandler beginHandler, EndEventHandler endHandler, object state) { _application = app; _beginHandler = beginHandler; _endHandler = endHandler; _state = state; _completionCallback = new AsyncCallback(OnAsyncEventCompletion); }
private void RecycleSpecialApplicationInstance(NetHttpApplication application) { if (_numFreeSpecialInstances < 20) { lock (_freeSpecialInstances) { _freeSpecialInstances.Push(application); _numFreeSpecialInstances++; } } }
internal void RecycleApplicationInstance(NetHttpApplication application) { if (_numFreeInstances < 20) { lock (_freeInstances) { _freeInstances.Push(application); _numFreeInstances++; } } }
internal void ClearReferences() { _appInstance = null; //_handler = null; //_handlerStack = null; _currentHandler = null; //if (_isIntegratedPipeline) //{ // _items = null; // _syncContext = null; //} }
private NetHttpApplication GetSpecialApplicationInstance(NetHttpContext context) { NetHttpApplication application = null; lock (_freeSpecialInstances) if (_numFreeSpecialInstances > 0) { application = (NetHttpApplication)_freeSpecialInstances.Pop(); _numFreeSpecialInstances--; } if (application == null) { application = (NetHttpApplication)NetHttpRuntime.CreateNonPublicInstance(_applicationType, null); application.InitSpecial(context, _state, this, _eventHandlerMethods); } return(application); }
internal NetHttpApplication GetApplicationInstance(NetHttpWorkerRequest wr, NetHttpContext context) { EnsureInited(); EnsureAppStartCalled(context); // NetHttpApplication application = null; lock (_freeInstances) if (_numFreeInstances > 0) { application = (NetHttpApplication)_freeInstances.Pop(); _numFreeInstances--; } if (application == null) { application = (NetHttpApplication)NetHttpRuntime.CreateNonPublicInstance(_applicationType, null); application.InitInternal(wr, context, _state, this, _eventHandlerMethods); } return(application); }
internal void EnsureAppStartCalledForIntegratedMode(NetHttpContext context, NetHttpApplication application) { if (!_appOnStartCalled) { Exception innerException = null; lock (this) { if (!_appOnStartCalled) { if (_onStartMethod != null) { application.ProcessSpecialRequest(context, _onStartMethod, _onStartParamCount, this, EventArgs.Empty, null); } } _appOnStartCalled = true; innerException = context.Error; } if (innerException != null) { throw new HttpException(innerException.Message, innerException); } } }
internal CallHandlerExecutionStep(NetHttpApplication app) { _application = app; _completionCallback = new AsyncCallback(OnAsyncHandlerCompletion); }
internal void AddHandler(object eventId, BeginEventHandler beginHandler, EndEventHandler endHandler, object state, RequestNotification requestNotification, bool isPost, NetHttpApplication app) { if (_table == null) { _table = new Hashtable(); } var handler = (AsyncAppEventHandler)_table[eventId]; if (handler == null) { handler = new AsyncAppEventHandler(); _table[eventId] = handler; } handler.Add(beginHandler, endHandler, state); //if (HttpRuntime.UseIntegratedPipeline) //{ // var step = new AsyncEventExecutionStep(app, beginHandler, endHandler, state); // app.AddEventMapping(app.CurrentModuleCollectionKey, requestNotification, isPost, step); //} }
internal MapHandlerExecutionStep(NetHttpApplication app) { _application = app; }
public ApplicationNetStepManager(NetHttpApplication application) : base(application) { }
internal NetAspNetSynchronizationContext(NetHttpApplication application) { _application = application; }
internal static void ProcessRequestNow(WebHost host, WebHostWorkerRequest wr, NetHttpApplicationFactory applicationFactory) { wr.ResetStartTime(); NetHttpContext context; try { context = new NetHttpContext(wr); } catch { wr.SendStatus(400, "Bad Request"); wr.SendKnownResponseHeader(12, "text/html; charset=utf-8"); var bytes = Encoding.ASCII.GetBytes("<html><body>Bad Request</body></html>"); wr.SendResponseFromMemory(bytes, bytes.Length); wr.FlushResponse(true); wr.EndOfRequest(); return; } Console.WriteLine("a:Request"); wr.SetEndOfSendNotification(_asyncEndOfSendCallback, context); Interlocked.Increment(ref host._activeRequests); NetHttpApplication application = null; try { try { EnsureFirstRequestInit(context); } catch { if (!((NetHttpRequest)context.Request).IsDebuggingRequest) { throw; } } ((NetHttpResponse)context.Response).InitResponseWriter(); application = applicationFactory.GetApplicationInstance(wr, context); if (application == null) { throw new HttpException("Unable_create_app_object"); } if (application is INetHttpAsyncHandler) { var handler2 = (INetHttpAsyncHandler)application; context.AsyncAppHandler = handler2; handler2.BeginProcessRequest(context, _handlerCompletionCallback, context); } else { ((INetHttpHandler)application).ProcessRequest(context); FinishRequest(host, context.WorkerRequest, context, null); } } catch (Exception ex) { ((NetHttpResponse)context.Response).InitResponseWriter(); FinishRequest(host, wr, context, ex); } finally { if (application != null) { applicationFactory.RecycleApplicationInstance(application); } } }
internal CallFilterExecutionStep(NetHttpApplication app) { _application = app; }
internal SyncEventExecutionStep(NetHttpApplication app, EventHandler handler) { _application = app; _handler = handler; }
internal NetStepManager(NetHttpApplication app) { _application = app; }