Example #1
0
        /// <summary>
        /// Handle the actual callback by deferring to JsonCallbackMethodProcessor()
        /// </summary>
        /// <param name="context"></param>
        public virtual void ProcessRequest(HttpContext context)
        {
            Request  = context.Request;
            Response = context.Response;
            Context  = context;

            var pathInfo = Request.PathInfo;

            // handle WCF/ASMX style type wrappers for handler implementation
            // returns a separate dynamic link with the JavaScript Service Proxy
            if (pathInfo == "/jsdebug" ||
                pathInfo == "/js")
            {
                GenerateClassWrapperForCallbackMethods();
                return;
            }

            // Pass off to the worker Callback Processor

            ICallbackMethodProcessor processor;

            // default format is JSON - check for others
            string format = (context.Request.Params["format"] ?? "").ToLower();

            // check accept types
            if (string.IsNullOrEmpty(format))
            {
                if (context.Request.AcceptTypes.Where(str => str.Contains(ControlResources.STR_JsonContentType) || str.Contains(ControlResources.STR_JavaScriptContentType)).Count() > 0)
                {
                    format = "json";
                }
                else if (context.Request.AcceptTypes.Where(str => str.Contains(ControlResources.STR_XmlContentType)).Count() > 0)
                {
                    format = "xml";
                }
            }

            if (format == "xml")
            {
                processor = new XmlCallbackMethodProcessor();
            }
            else
            {
                processor = new JsonCallbackMethodProcessor();
            }

            // Process the inbound request and execute it on this
            // Http Handler's methods
            processor.ProcessCallbackMethodCall(this);

            Request  = null;
            Response = null;
            Context  = null;
        }
        protected void HandleCallback()
        {
            if (TargetInstance == null)
                TargetInstance = Page;

            // Delegate off handling to the Callback Processor 
            // which handles routing and calling the method and returning
            // a JSON response
            ICallbackMethodProcessor processor = new JsonCallbackMethodProcessor();
            processor.JsonDateEncoding = JsonDateEncoding;

            // Let the Processor do all the work of parsing parms, calling and returning result
            processor.ProcessCallbackMethodCall(TargetInstance);
        }
        /// <summary>
        /// Handle the actual callback by deferring to JsonCallbackMethodProcessor()
        /// </summary>
        /// <param name="context"></param>
        public virtual void ProcessRequest(HttpContext context)
        {
            Request = context.Request;
            Response = context.Response;
            Context = context;

            var pathInfo = Request.PathInfo;
            // handle WCF/ASMX style type wrappers for handler implementation
            // returns a separate dynamic link with the JavaScript Service Proxy
            if (pathInfo == "/jsdebug" ||
                pathInfo == "/js")
            {
                GenerateClassWrapperForCallbackMethods();
                return;
            }

            // Pass off to the worker Callback Processor

            ICallbackMethodProcessor processor;

            // default format is JSON - check for others
            string format = (context.Request.Params["format"] ?? "").ToLower();

            // check accept types
            if (string.IsNullOrEmpty(format))
            {
                if (context.Request.AcceptTypes.Where(str => str.Contains(ControlResources.STR_JsonContentType) || str.Contains(ControlResources.STR_JavaScriptContentType)).Count() > 0)
                    format = "json";
                else if (context.Request.AcceptTypes.Where(str => str.Contains(ControlResources.STR_XmlContentType)).Count() > 0)
                    format = "xml";
            }

            if (format == "xml")
                processor = new XmlCallbackMethodProcessor();
            else
                processor = new JsonCallbackMethodProcessor();

            // Process the inbound request and execute it on this 
            // Http Handler's methods 
            processor.ProcessCallbackMethodCall(this);

            Request = null;
            Response = null;
            Context = null;
        }