Ext.Net.ResourceHandler.ProcessRequest C# (CSharp) Method

ProcessRequest() private method

private ProcessRequest ( HttpContext context ) : void
context System.Web.HttpContext
return void
        public override void ProcessRequest(HttpContext context)
        {
            this.context = context;
            
            string file = this.context.Request.RawUrl;

            bool isInitScript = file.Contains("extnet/extnet-init-js/ext.axd?");

            if ((!isInitScript && !ResourceHandler.IsSourceModified(context.Request)) || (isInitScript && !string.IsNullOrEmpty(context.Request.Headers["If-Modified-Since"])))
            {
                context.Response.SuppressContent = true;
                context.Response.StatusCode = 304;
                context.Response.StatusDescription = "Not Modified";
                context.Response.AddHeader("Content-Length", "0");
                return;
            }            
            
            this.SetResponseCache(context);

            if (isInitScript)
            {
                string key = file.RightOfRightmostOf('?');

                if (key.IsNotEmpty())
                {
                    try
                    {
                        string script = this.context.Session[key].ToString();
                        this.context.Session.Remove(key);                        
                        CompressionUtils.GZipAndSend(script);
                    }
                    catch (NullReferenceException)
                    {
                        throw new InitializationScriptNotFoundException("The Ext.NET initialization script was not found.");
                    }
                }
            }
            else
            {
                try
                {
                    this.sm = new ResourceManager();
                    this.compress = CompressionUtils.IsGZipSupported && this.sm.GZip;

                    this.SetWebResourceName(file);

                    this.stream = this.GetType().Assembly.GetManifestResourceStream(this.webResource);
                    string ext = this.webResource.RightOfRightmostOf('.');
                    this.compress = this.compress && !this.IsImage(ext);

                    switch (ext)
                    {
                        case "js":
                            this.WriteFile("text/javascript");
                            break;
                        case "css":
                            this.WriteFile("text/css");
                            break;

                        case "gif":
                            this.WriteImage("image/gif");
                            break;
                        case "png":
                            this.WriteImage("image/png");
                            break;
                        case "jpg":
                        case "jpeg":
                            this.WriteImage("image/jpg");
                            break;
                    }
                }
                catch (Exception e)
                {
                    string s = this.IsDebugging ? e.ToString() : e.Message;
                    context.Response.StatusDescription = s.Substring(0, Math.Min(s.Length, 512));
                    this.context.Response.Redirect(Page.ClientScript.GetWebResourceUrl(this.sm.GetType(), this.webResource));
                }
                finally
                {
                    if (this.stream != null)
                    {
                        this.stream.Close();
                    }
                }
            }
        }