internal static OwinAppContext Build(Action<IAppBuilder> startup) { if (startup == null) { throw new ArgumentNullException("startup"); } var appContext = new OwinAppContext(); appContext.Initialize(startup); return appContext; }
internal static OwinAppContext Build(Action<IAppBuilder> startup) { if (startup == null) { return null; } var appContext = new OwinAppContext(); appContext.Initialize(startup); return appContext; }
internal static OwinAppContext Build(Action <IAppBuilder> startup) { if (startup == null) { throw new ArgumentNullException("startup"); } var appContext = new OwinAppContext(); appContext.Initialize(startup); return(appContext); }
internal static OwinAppContext Build(Action <IAppBuilder> startup) { if (startup == null) { return(null); } var appContext = new OwinAppContext(); appContext.Initialize(startup); return(appContext); }
/// <summary> /// Initialize an OwinRouteHandler /// </summary> /// <param name="startup">The method to initialize the pipeline that processes requests for the route.</param> public OwinRouteHandler(Action <IAppBuilder> startup) { _pathBase = Utils.NormalizePath(HttpRuntime.AppDomainAppVirtualPath); OwinAppContext app = null; bool initialized = false; var syncLock = new object(); _appAccessor = () => LazyInitializer.EnsureInitialized( ref app, ref initialized, ref syncLock, () => OwinBuilder.Build(startup)); }
private IntegratedPipelineBlueprint InitializeBlueprint() { IntegratedPipelineBlueprintStage firstStage = null; Action <IAppBuilder> startup = OwinBuilder.GetAppStartup(); OwinAppContext appContext = OwinBuilder.Build(builder => { EnableIntegratedPipeline(builder, stage => firstStage = stage); startup.Invoke(builder); }); string basePath = Utils.NormalizePath(HttpRuntime.AppDomainAppVirtualPath); return(new IntegratedPipelineBlueprint(appContext, firstStage, basePath)); }
public IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, object extraData) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } try { OwinAppContext appContext = _appAccessor.Invoke(); if (appContext == null) { throw new EntryPointNotFoundException(Resources.Exception_NoOwinEntryPointFound); } // REVIEW: the httpContext.Request.RequestContext may be used here if public property unassigned? RequestContext requestContext = _requestContext ?? new RequestContext(httpContext, new RouteData()); string requestPathBase = _pathBase; string requestPath = _requestPath ?? httpContext.Request.AppRelativeCurrentExecutionFilePath.Substring(1) + httpContext.Request.PathInfo; OwinCallContext callContext = appContext.CreateCallContext( requestContext, requestPathBase, requestPath, callback, extraData); try { callContext.Execute(); } catch (Exception ex) { callContext.AsyncResult.Complete(true, ErrorState.Capture(ex)); } return(callContext.AsyncResult); } catch (Exception ex) { var failedAsyncResult = new CallContextAsyncResult(null, callback, extraData); failedAsyncResult.Complete(true, ErrorState.Capture(ex)); return(failedAsyncResult); } }
internal OwinCallContext( OwinAppContext appContext, RequestContext requestContext, string requestPathBase, string requestPath, AsyncCallback cb, object extraData) { _appContext = appContext; _requestContext = requestContext; _requestPathBase = requestPathBase; _requestPath = requestPath; AsyncResult = new CallContextAsyncResult(this, cb, extraData); _httpContext = _requestContext.HttpContext; _httpRequest = _httpContext.Request; _httpResponse = _httpContext.Response; }
internal OwinCallContext( OwinAppContext appContext, RequestContext requestContext, string requestPathBase, string requestPath, AsyncCallback cb, object extraData) { _trace = TraceFactory.Create(TraceName); _appContext = appContext; _requestContext = requestContext; _requestPathBase = requestPathBase; _requestPath = requestPath; AsyncResult = new CallContextAsyncResult(this, cb, extraData); _httpContext = _requestContext.HttpContext; _httpRequest = _httpContext.Request; _httpResponse = _httpContext.Response; }
internal OwinCallContext( OwinAppContext appContext, RequestContext requestContext, string requestPathBase, string requestPath, AsyncCallback cb, object extraData) { _appContext = appContext; _requestContext = requestContext; _requestPathBase = requestPathBase; _requestPath = requestPath; AsyncResult = new CallContextAsyncResult(this, cb, extraData); _httpContext = _requestContext.HttpContext; _httpRequest = _httpContext.Request; _httpResponse = _httpContext.Response; _disconnectWatcher = new DisconnectWatcher(_httpResponse); }
internal OwinCallContext( OwinAppContext appContext, RequestContext requestContext, string requestPathBase, string requestPath, AsyncCallback cb, object extraData) { _appContext = appContext; _requestContext = requestContext; _requestPathBase = requestPathBase; _requestPath = requestPath; AsyncResult = new CallContextAsyncResult(this, cb, extraData); _httpContext = _requestContext.HttpContext; _httpRequest = _httpContext.Request; _httpResponse = _httpContext.Response; _disconnectWatcher = new DisconnectWatcher(_httpResponse); RegisterForOnSendingHeaders(); }
internal OwinHttpHandler(string pathBase, OwinAppContext app) : this(pathBase, () => app) { }