示例#1
0
 /// <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);
 }
示例#2
0
 /// <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);
 }
示例#3
0
        /// <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));
        }
示例#5
0
        /// <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);
        }
示例#6
0
 /// <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);
 }