/// <summary> /// /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { ResponseType = ResponseType.Json; ResponseFormater = new JsonResponseFormater(); var body = new ResponseBody(); OnRequest(context, body); ProcessResponse(context.Response, body); }
/// <summary> /// /// </summary> /// <param name="context"></param> public byte[] ProcessRequest(IHttpRequestContext context) { ResponseType = ResponseType.Json; ResponseFormater = new JsonResponseFormater(); var body = new ResponseBody(); OnRequest(context, body); return ProcessResponse(context, body); }
/// <summary> /// /// </summary> /// <param name="context"></param> public byte[] ProcessRequest(IHttpRequestContext context) { ResponseType = ResponseType.Json; ResponseFormater = new JsonResponseFormater(); var body = new ResponseBody(); OnRequest(context, body); return(ProcessResponse(context, body)); }
/// <summary> /// /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { ResponseType = ResponseType.Json; ResponseFormater = new JsonResponseFormater(); var body = new ResponseBody(); try { string param; if (CheckSign(context.Request, out param)) { HandlerData handlerData; if (TryUrlQueryParse(param, out handlerData)) { body.Handler = handlerData.Name; body.Data = HandlerManager.Excute(handlerData); } else { body.StateCode = StateCode.NoHandler; body.StateDescription = string.Format("Not found \"{0}\" handler.", param); } } else { body.StateCode = StateCode.SignError; body.StateDescription = "Sign error."; } } catch (HandlerException handlerError) { body.StateCode = handlerError.StateCode; body.StateDescription = handlerError.Message; TraceLog.WriteError("Request handle error:{0}", handlerError); } catch (Exception error) { body.StateCode = StateCode.Error; body.StateDescription = "Process request fail."; TraceLog.WriteError("Request handle error:{0}", error); } ProcessResponse(context.Response, body); }