public override void ProcessRequest(HttpContextBase context)
{
string id = context.Request.QueryString[IdParameterName];
if (!string.IsNullOrEmpty(id))
{
WebAsset asset = assetRegistry.Retrieve(id);
if (asset != null)
{
HttpResponseBase response = context.Response;
// Set the content type
response.ContentType = asset.ContentType;
string content = asset.Content;
if (!string.IsNullOrEmpty(content))
{
// Compress
if (asset.Compress && !context.IsMono())
{
httpResponseCompressor.Compress(context);
}
// Write
using (StreamWriter sw = new StreamWriter((response.OutputStream)))
{
sw.Write(content);
}
// Cache
if (!context.IsDebuggingEnabled)
{
httpResponseCacher.Cache(context, TimeSpan.FromDays(asset.CacheDurationInDays));
}
}
}
}
}