예제 #1
0
        private void SetupAndInvokeGetRequest(Type channel,
                                              MethodInfo method,
                                              ChannelMethodDeserializerFactory dsrFactory,
                                              HttpListenerRequest request,
                                              HttpListenerResponse response,
                                              ChannelMethodInfo methodDescription,
                                              ChannelConfigurationInfo channelConfig,
                                              List <object> channelRequestBody,
                                              bool authenticated,
                                              bool hasParams)
        {
            InitChannelMethodContext(channelConfig.Endpoint, request, response, authenticated, channelConfig.HttpMethod, channelRequestBody);
            if (hasParams)
            {
                dsrFactory         = new ChannelMethodDeserializerFactory(request.QueryString);
                channelRequestBody = dsrFactory.DeserializeFromQueryParameters(methodDescription);
                _requestActivator.GetActivateWithParameters(channel, method, channelRequestBody, response);
            }
            else
            {
                _requestActivator.GetActivateWithoutParameters(channel, method, response);
            }

            _contextProvider.DestroyChannelMethodContext(channelConfig.Endpoint);
        }
        internal void SetupAndInvokeGetRequest(Type channel,
                                               MethodInfo method,
                                               HttpListenerRequest request,
                                               HttpListenerResponse response,
                                               ChannelMethodInfo methodDescription,
                                               ChannelConfigurationInfo channelConfig,
                                               List <object> channelRequestBody,
                                               bool authenticated,
                                               bool hasParams,
                                               CacheExecutionResult cacheExecutionResult)
        {
            //Context should be initialized before invoking the method because ChannelBase relies on Context
            InitChannelMethodContext(channelConfig.Endpoint, request, response, authenticated, channelConfig.HttpMethod, channelRequestBody);
            if (hasParams)
            {
                //Since request body will be processed in Heuristics if cache is enabled
                //Data is already stored in Data.Parameters property of CacheExecutionResult
                if (!cacheExecutionResult.DataProcessed)
                {
                    _dsrFactory        = new ChannelMethodDeserializerFactory(request.QueryString);
                    channelRequestBody = _dsrFactory.DeserializeFromQueryParameters(methodDescription);
                }
                else
                {
                    channelRequestBody = cacheExecutionResult.Data.Parameters;
                }

                _requestActivator.GetActivateWithParameters(channel, method, channelRequestBody, response);
            }
            else
            {
                _requestActivator.GetActivateWithoutParameters(channel, method, response);
            }

            _contextProvider.DestroyChannelMethodContext(channelConfig.Endpoint);
        }