BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler.ProcessRequest C# (CSharp) Method

ProcessRequest() public method

Enables processing of HTTP Web requests by a custom HttpHandler that implements the interface.
public ProcessRequest ( HttpContext context ) : void
context System.Web.HttpContext /// An object that provides /// references to the intrinsic server objects /// (for example, Request, Response, Session, and Server) used to service HTTP requests. ///
return void
        public void ProcessRequest(HttpContext context)
        {
            var request = context.Request;
            string fileName = request.FilePath;
            fileName = fileName.Substring(Utils.RelativeWebRoot.Length);

            string resKey = "";
            string script = "";

            if (fileName.StartsWith("res-"))
            {
                resKey = fileName.Substring(4);
                resKey = resKey.Substring(0, resKey.IndexOf("."));

                if (Blog.CurrentInstance.Cache[resKey] != null)
                {
                    script = (string)Blog.CurrentInstance.Cache[resKey];
                }
            }

            SetHeaders(script.GetHashCode(), context);
            context.Response.Write(script);
        }