예제 #1
0
        public void ProcessHttpRequest(HttpContext httpContext, IHttpEndpoint <TResponse> httpEndpoint)
        {
            TResponse response;

            if (httpEndpoint.BeforePerformActions != null &&
                httpEndpoint.BeforePerformActions
                .Any(beforePerformAction => beforePerformAction.PrePerform(httpContext) == false))
            {
                response = default(TResponse);
            }
            else
            {
                response = httpEndpoint.Performer.Perform();
            }

            if (httpEndpoint.AfterPerformActions != null)
            {
                httpEndpoint.AfterPerformActions
                .DoUntil(afterPerformAction => afterPerformAction.PostPerform(httpContext) == false);
            }

            _responseHeadersWritter.WriteResponseHeaders(httpContext);

            httpEndpoint.ResponseWritter.WriteResponse(httpContext, response);
        }
예제 #2
0
        public void Bootstrap(
            IHttpEndpoint <TResponse> endpoint,
            string routeDescription,
            Func <HttpContext, TResponse> perform        = null,
            List <IPrePerformAction> prePerformActions   = null,
            List <IPostPerformAction> postPerformActions = null,
            IResponseWritter <TResponse> responseWritter = null)
        {
            endpoint.HttpRequestDescriptor = new GenericRequestDescriptor
            {
                HttpMethod       = _getHttpMethod,
                RouteDescription = routeDescription
            };

            endpoint.ResponseWritter = responseWritter ?? _jsonResponseWritter;
        }
예제 #3
0
 public void OnException(Exception exception, HttpContext httpContext, IHttpEndpoint httpEndpoint)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 public void OnException(Exception exception, HttpContext httpContext, IHttpEndpoint httpEndpoint)
 {
     throw new NotImplementedException();
 }