aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Net/Handlers/JsonHandler.cs
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-07-19 22:22:44 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-07-19 22:22:44 -0400
commit80b3ad7bd20329e6a5bbf6eeb76af62c87434a7c (patch)
tree81ab455261cf30fab4b932215211d8cd0e57547a /MediaBrowser.Common/Net/Handlers/JsonHandler.cs
parent6fbd5cf46407a212fadb52eee00c7ac7690430ea (diff)
Moved the http server to it's own assembly. added comments and made other minor re-organizations.
Diffstat (limited to 'MediaBrowser.Common/Net/Handlers/JsonHandler.cs')
-rw-r--r--MediaBrowser.Common/Net/Handlers/JsonHandler.cs36
1 files changed, 0 insertions, 36 deletions
diff --git a/MediaBrowser.Common/Net/Handlers/JsonHandler.cs b/MediaBrowser.Common/Net/Handlers/JsonHandler.cs
deleted file mode 100644
index ecfdd311a..000000000
--- a/MediaBrowser.Common/Net/Handlers/JsonHandler.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.IO;
-using System.IO.Compression;
-using MediaBrowser.Common.Json;
-
-namespace MediaBrowser.Common.Net.Handlers
-{
- public abstract class JsonHandler : Response
- {
- public JsonHandler(RequestContext ctx)
- : base(ctx)
- {
- Headers["Content-Encoding"] = "gzip";
-
- WriteStream = s =>
- {
- WriteReponse(s);
- s.Close();
- };
- }
-
- public override string ContentType
- {
- get { return "application/json"; }
- }
-
- protected abstract object ObjectToSerialize { get; }
-
- private void WriteReponse(Stream stream)
- {
- using (GZipStream gzipStream = new GZipStream(stream, CompressionMode.Compress, false))
- {
- JsonSerializer.SerializeToStream(ObjectToSerialize, gzipStream);
- }
- }
- }
-}