/// <summary> /// Constructs this <see cref="MansionHttpHandlerBase"/> with the given <paramref name="requestHandler"/>. /// </summary> /// <param name="requestContext">The <see cref="MansionWebContext"/> for this request.</param> /// <param name="requestHandler">The <see cref="RequestHandler"/> which does the actual work of handling the request.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="requestHandler"/> is null.</exception> protected MansionHttpHandlerBase(MansionWebContext requestContext, RequestHandler requestHandler) { // validate arguments if (requestContext == null) throw new ArgumentNullException("requestContext"); if (requestHandler == null) throw new ArgumentNullException("requestHandler"); // set values webRequestContext = requestContext; this.requestHandler = requestHandler; }
/// <summary> /// Constructs this <see cref="MansionHttpHandlerBase"/> with the given <paramref name="requestHandler"/>. /// </summary> /// <param name="requestContext">The <see cref="MansionWebContext"/> for this request.</param> /// <param name="requestHandler">The <see cref="RequestHandler"/> which does the actual work of handling the request.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="requestHandler"/> is null.</exception> public StatelessHttpHander(MansionWebContext requestContext, RequestHandler requestHandler) : base(requestContext, requestHandler) { }
/// <summary> /// Returns an instance of a class that implements the <see cref="T:System.Web.IHttpHandler"/> interface. /// </summary> /// <returns> /// A new <see cref="T:System.Web.IHttpHandler"/> object that processes the request. /// </returns> /// <param name="context">An instance of the <see cref="T:System.Web.HttpContextBase"/> class that provides references to intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests. </param> /// <param name="requestHandler">The <see cref="RequestHandler"/> which does the actual work of handling the request.</param> protected virtual IHttpHandler DoGetHandler(MansionWebContext context, RequestHandler requestHandler) { // determine if the request is stateful or not string requiredStateString; if (!context.Request.RequestUrl.QueryString.TryGetValue(StateQueryStringParameterName, out requiredStateString)) requiredStateString = string.Empty; // parse the required session state from the query srting var requiredByQueryString = RequiresSessionState.Parse(requiredStateString); // determine the highest state var highestStateDemanded = RequiresSessionState.DetermineHighestDemand(requiredByQueryString, requestHandler.MinimalSessionStateDemand); // switch to the corrent http handler if (highestStateDemanded == RequiresSessionState.Full) return new StatefulHttpHandler(context, requestHandler); if (highestStateDemanded == RequiresSessionState.ReadOnly) return new ReadOnlyStateHttpHandler(context, requestHandler); if (highestStateDemanded == RequiresSessionState.No) return new StatelessHttpHander(context, requestHandler); throw new InvalidOperationException("Uknown session state demanded"); }
/// <summary> /// Constructs this <see cref="MansionHttpHandlerBase"/> with the given <paramref name="requestHandler"/>. /// </summary> /// <param name="requestContext">The <see cref="MansionWebContext"/> for this request.</param> /// <param name="requestHandler">The <see cref="RequestHandler"/> which does the actual work of handling the request.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="requestHandler"/> is null.</exception> public ReadOnlyStateHttpHandler(MansionWebContext requestContext, RequestHandler requestHandler) : base(requestContext, requestHandler) { }