private CacheExecutionResult TryInvokeGetMethod(ChannelMethodHeuristicOptions options, HeuristicsInfo hInfo)
        {
            CacheExecutionResult result = new CacheExecutionResult();

            if (options.Request.QueryString.AllKeys.Length == 0)
            {
                _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response);
                result.Executed = true;
                return(result);
            }
            else
            {
                ChannelMethodDeserializerFactory dsrFactory = new ChannelMethodDeserializerFactory(options.Request.QueryString);
                List <object> requestParameters             = dsrFactory.DeserializeFromQueryParameters(_descriptor.GetMethodDescription(options.ChannelMethod));

                if (ParameteresMatch(hInfo.Parameters, requestParameters))
                {
                    _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response);
                    result.Executed = true;
                    return(result);
                }
                else
                {
                    result.Executed        = false;
                    result.DataProcessed   = true;
                    result.Data.HasData    = true;
                    result.Data.Parameters = requestParameters;
                    return(result);
                }
            }
        }
        private void WriteResponse(object channelMethodReturnValue, HttpListenerResponse response)
        {
            if (alreadyInvokedFlag)
            {
                alreadyInvokedFlag = false;
                return;
            }

            _channelMessageService.WriteHttpResponse(channelMethodReturnValue, response);
        }
Esempio n. 3
0
        private bool TryInvokeGetMethod(ChannelMethodHeuristicOptions options, HeuristicsInfo hInfo)
        {
            if (options.Request.QueryString.AllKeys.Length == 0)
            {
                _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response);
                return(true);
            }
            else
            {
                ChannelMethodDeserializerFactory dsrFactory = new ChannelMethodDeserializerFactory(options.Request.QueryString);
                List <object> requestParameters             = dsrFactory.DeserializeFromQueryParameters(_descriptor.GetMethodDescription(options.ChannelMethod));

                if (requestParameters == hInfo.Parameters)
                {
                    _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        private void WriteResponse(object channelMethodReturnValue, HttpListenerResponse response, bool asPureJson)
        {
            if (alreadyInvokedFlag)
            {
                alreadyInvokedFlag = false;
                return;
            }

            if (asPureJson)
            {
                _channelMessageService.WriteHttpResponseAsPureJson(channelMethodReturnValue, response, false);
            }
            else
            {
                _channelMessageService.WriteHttpResponse(channelMethodReturnValue, response);
            }
        }
Esempio n. 5
0
 public void Write(IChannelMessage message, HttpListenerResponse response)
 {
     _msgService.WriteHttpResponse(message, response);
     OnPostMessageServiceInvoked?.Invoke(this, EventArgs.Empty);
 }