Moved the http server to it's own assembly. added comments and made other minor re-organizations.

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-07-19 22:22:44 -04:00
parent 6fbd5cf464
commit 80b3ad7bd2
67 changed files with 806 additions and 964 deletions

View File

@@ -1,27 +1,14 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Model.Entities;
using MediaBrowser.Net.Handlers;
namespace MediaBrowser.Api.HttpHandlers
{
public class ImageHandler : Response
public class ImageHandler : BaseHandler
{
public ImageHandler(RequestContext ctx)
: base(ctx)
{
Headers["Content-Encoding"] = "gzip";
WriteStream = s =>
{
WriteReponse(s);
s.Close();
};
}
private string _ImagePath = string.Empty;
private string ImagePath
{
@@ -149,12 +136,9 @@ namespace MediaBrowser.Api.HttpHandlers
}
}
private void WriteReponse(Stream stream)
protected override void WriteResponseToOutputStream(Stream stream)
{
using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Compress, false))
{
ImageProcessor.ProcessImage(ImagePath, gzipStream, Width, Height, MaxWidth, MaxHeight, Quality);
}
ImageProcessor.ProcessImage(ImagePath, stream, Width, Height, MaxWidth, MaxHeight, Quality);
}
private string GetImagePath()