From b50f78e5da6f3fdfc59e577ca61b88771da7d211 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Thu, 12 Jul 2012 02:55:27 -0400 Subject: Initial check-in --- MediaBrowser.Controller/Net/Response.cs | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 MediaBrowser.Controller/Net/Response.cs (limited to 'MediaBrowser.Controller/Net/Response.cs') diff --git a/MediaBrowser.Controller/Net/Response.cs b/MediaBrowser.Controller/Net/Response.cs new file mode 100644 index 000000000..a119198cb --- /dev/null +++ b/MediaBrowser.Controller/Net/Response.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace MediaBrowser.Controller.Net +{ + public class Response + { + protected RequestContext RequestContext { get; private set; } + + public Response(RequestContext ctx) + { + RequestContext = ctx; + + WriteStream = s => { }; + StatusCode = 200; + Headers = new Dictionary(); + CacheDuration = TimeSpan.FromTicks(0); + ContentType = "text/html"; + } + + public int StatusCode { get; set; } + public string ContentType { get; set; } + public IDictionary Headers { get; set; } + public TimeSpan CacheDuration { get; set; } + public Action WriteStream { get; set; } + } + + /*public class ByteResponse : Response + { + public ByteResponse(byte[] bytes) + { + WriteStream = async s => + { + await s.WriteAsync(bytes, 0, bytes.Length); + s.Close(); + }; + } + } + + public class StringResponse : ByteResponse + { + public StringResponse(string message) + : base(Encoding.UTF8.GetBytes(message)) + { + } + }*/ +} \ No newline at end of file -- cgit v1.2.3