/// <summary>
        /// 通过实现 System.Web.IHttpHandler 接口的自定义 HttpHandler 启用 HTTP Web 请求的处理。
        /// </summary>
        /// <param name="context">它提供对用于为 HTTP 请求提供服务的内部服务器对象(如 Request、Response、Session和 Server)的引用。</param>
        public void ProcessRequest(HttpContext context)
        {
            WebRequestDecoder webRequestDecoder = WebRequestDecoder.CreateInstance(context);

            if (webRequestDecoder == null)
            {
                webRequestDecoder = new SimpleUrlDecoder(context);
            }
            string logicalMethod = webRequestDecoder.LogicalMethod;
            ResponseAnnotationAttribute methodAnnotation   = this.GetMethodAnnotation(logicalMethod);
            WebResponseEncoder          webResponseEncoder = WebResponseEncoder.CreateInstance(context, methodAnnotation.ResponseFormat);

            if (webResponseEncoder == null)
            {
                webResponseEncoder = new JQueryScriptEncoder(context);
            }
            try
            {
                this.Pre_Invoke(context);
                object srcObj = this.InvokeMethod(logicalMethod, webRequestDecoder.Deserialize());
                webResponseEncoder.Write(srcObj);
            }
            catch (Exception ex)
            {
                string message = (ex.InnerException == null) ? ex.Message : ex.InnerException.Message;
                this.ResponseException(context, message, webResponseEncoder);
            }
            WebAjaxHandler.InitializeCachePolicy(context, methodAnnotation);
        }
        /// <summary>
        /// 创建响编码器
        /// </summary>
        /// <param name="context">当前上下文</param>
        /// <param name="format">类型格式</param>
        /// <returns>结果</returns>
        public static WebResponseEncoder CreateInstance(HttpContext context, ResponseFormat format)
        {
            WebResponseEncoder result;

            switch (format)
            {
            case ResponseFormat.JSON:
                result = new JsonEncoder(context);
                break;

            case ResponseFormat.HTML:
                result = new HtmlEncoder(context);
                break;

            case ResponseFormat.XML:
                result = new XmlEncoder(context);
                break;

            case ResponseFormat.JAVASCRIPT:
                result = new JQueryScriptEncoder(context);
                break;

            default:
                result = new MiscEncoder(context);
                break;
            }
            return(result);
        }