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 CacheExecutionResult TryInvokePostMethod(ChannelMethodHeuristicOptions options, HeuristicsInfo hInfo) { CacheExecutionResult result = new CacheExecutionResult(); if (options.Request.HasEntityBody) { ChannelMethodDeserializerFactory dsrFactory = new ChannelMethodDeserializerFactory(options.Request.InputStream); List <object> requestParameters = dsrFactory.DeserializeFromBody(_descriptor.GetMethodDescription(options.ChannelMethod), options.Request.ContentType); if (ParameteresMatch(hInfo.Parameters, requestParameters)) { _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response); result.Executed = true; } else { result.Executed = false; result.DataProcessed = true; result.Data.HasData = true; result.Data.Parameters = requestParameters; } } else { _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response); result.Executed = true; } return(result); }
public CacheExecutionResult Execute(ChannelMethodHeuristicOptions options, HeuristicsInfo hInfo) { string method = options.Request.HttpMethod; if (method == "GET") { return(TryInvokeGetMethod(options, hInfo)); } else { return(TryInvokePostMethod(options, hInfo)); } }
private bool TryInvokePostMethod(ChannelMethodHeuristicOptions options, HeuristicsInfo hInfo) { if (options.Request.HasEntityBody) { ChannelMethodDeserializerFactory dsrFactory = new ChannelMethodDeserializerFactory(options.Request.InputStream); List <object> requestParameters = dsrFactory.DeserializeFromBody(_descriptor.GetMethodDescription(options.ChannelMethod), options.Request.ContentType); if (requestParameters == hInfo.Parameters) { _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response); return(true); } else { return(true); } } else { _msgService.WriteHttpResponse(hInfo.MethodResponse, options.Response); return(true); } }
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); } } }