示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            DirectProvider provider = this.GetProvider(context, this.ProviderName);
            string         data     = string.Empty;
            string         type     = "text/javascript";

            // TotalBytes hangs sometimes, since it accesses the InputStream, which tries to complete loading in another thread
            // when not everything in the stream.
            // Use ContentLength instead...

            // This used to check for string.IsNullOrEmpty(context.Request["extAction"])) but in order to eliminate that from the hanging
            // candidates we've removed it, since we do not need form post at this stage.
            // When we do need it, making it more targetted may be an idea, such as content.Request.Form["extAction"] etc.
            if (context.Request.ContentLength == 0)
            {
                data = provider.ToString();
            }
            else
            {
                DirectExecutionResponse resp = DirectProcessor.Execute(provider, context.Request, this.GetConverters());
                data = resp.Data;
                if (resp.IsUpload)
                {
                    type = "text/html";
                }
            }

            context.Response.ContentType = type;
            context.Response.Write(data);
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            DirectProvider provider = this.GetProvider(context, this.ProviderName);
            string         data     = string.Empty;
            string         type     = "text/javascript";

            if (context.Request.TotalBytes == 0 && string.IsNullOrEmpty(context.Request["extAction"]))
            {
                data = provider.ToString();
            }
            else
            {
                DirectExecutionResponse resp = DirectProcessor.Execute(provider, context.Request, this.GetConverters());
                data = resp.Data;
                if (resp.IsUpload)
                {
                    type = "text/html";
                }
            }
            context.Response.ContentType = type;
            context.Response.Write(data);
        }