public SelfHostServiceArguments(RouteData routeData, HttpRequestMessage request, HttpResponseMessage response)
        {
            With(request);
            With(response);

            var httpRequest = new SelfHostCurrentHttpRequest(request);
            With<ICurrentHttpRequest>(httpRequest);

            With<IRequestData>(new SelfHostRequestData(routeData, request, httpRequest));

            With<IStreamingData>(new SelfHostStreamingData(request));
            _writer = new SelfHostHttpWriter(response, httpRequest);
            With<IHttpWriter>(_writer);
            With<IClientConnectivity>(new SelfHostClientConnectivity());
            With<IResponse>(new SelfHostResponse(response));
        }
        public SelfHostServiceArguments(RouteData routeData, HttpRequestMessage request, HttpResponseMessage response)
        {
            With(request);
            With(response);

            var httpRequest = new SelfHostCurrentHttpRequest(request);

            With <ICurrentHttpRequest>(httpRequest);

            With <IRequestData>(new SelfHostRequestData(routeData, request, httpRequest));

            With <IStreamingData>(new SelfHostStreamingData(request));
            _writer = new SelfHostHttpWriter(response, httpRequest);
            With <IHttpWriter>(_writer);
            With <IClientConnectivity>(new SelfHostClientConnectivity());
            With <IResponse>(new SelfHostResponse(response));
        }
示例#3
0
        public SelfHostRequestData(RouteData routeData, HttpRequestMessage request,
                                   SelfHostCurrentHttpRequest httpRequest)
        {
            AddValues(new RouteDataValues(routeData));


            NameValueCollection querystring = request.RequestUri.ParseQueryString();

            AddValues("Querystring", new NamedKeyValues(querystring));

            NameValueCollection formData = request.Content.IsFormData()
                                               ? request.Content.ReadAsFormDataAsync().Result
                                               : new NameValueCollection();

            AddValues(RequestDataSource.Request.ToString(), new NamedKeyValues(formData));

            AddValues(new CookieValueSource(new Cookies(httpRequest)));
            AddValues(new HeaderValueSource(httpRequest));
        }
 public SelfHostHttpWriter(HttpResponseMessage response, SelfHostCurrentHttpRequest httpRequest)
 {
     _response = response;
     _httpRequest = httpRequest;
     _writer = new Lazy<StreamWriter>(() => new StreamWriter(_output));
 }
示例#5
0
 public SelfHostHttpWriter(HttpResponseMessage response, SelfHostCurrentHttpRequest httpRequest)
 {
     _response    = response;
     _httpRequest = httpRequest;
     _writer      = new Lazy <StreamWriter>(() => new StreamWriter(_output));
 }