public void ProcessRequest(HttpContext context)
{
Query query = QueryHelper.ParseQuery();
string cacheKey = String.Format(CultureInfo.InvariantCulture,
Settings.ScriptsCacheKeyFormat,
Settings.AppVersion,
query.AssetList + "=" + AssetsHelper.SerializeAssets(query.Assets));
byte[] encodedBytes = (byte[]) CacheHelper.GetData(cacheKey, null,
DateTime.Now.AddHours(Settings.CacheDuration),
CacheItemPriority.NotRemovable,
delegate { return CombineScripts(query.Assets); });
context.Response.ContentType = AssetListTypeHelper.GetMimeType(query.AssetList.ListType);
context.Response.ContentEncoding = context.Request.ContentEncoding;
context.Response.Cache.SetMaxAge(TimeSpan.FromHours(Settings.CacheDuration));
context.Response.Cache.SetExpires(DateTime.Now.AddHours(Settings.CacheDuration));
context.Response.Cache.SetCacheability(HttpCacheability.Private);
context.Response.AppendHeader("Content-Length", encodedBytes.Length.ToString(CultureInfo.InvariantCulture));
context.Response.OutputStream.Write(encodedBytes, 0, encodedBytes.Length);
context.Response.Flush();
}