aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Net/Response.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common/Net/Response.cs')
-rw-r--r--MediaBrowser.Common/Net/Response.cs77
1 files changed, 77 insertions, 0 deletions
diff --git a/MediaBrowser.Common/Net/Response.cs b/MediaBrowser.Common/Net/Response.cs
new file mode 100644
index 000000000..44b4e2962
--- /dev/null
+++ b/MediaBrowser.Common/Net/Response.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.IO;
+
+namespace MediaBrowser.Common.Net
+{
+ public abstract class Response
+ {
+ protected RequestContext RequestContext { get; private set; }
+
+ protected NameValueCollection QueryString
+ {
+ get
+ {
+ return RequestContext.Request.QueryString;
+ }
+ }
+
+ public Response(RequestContext ctx)
+ {
+ RequestContext = ctx;
+
+ WriteStream = s => { };
+ Headers = new Dictionary<string, string>();
+ }
+
+ public abstract string ContentType { get; }
+
+ public virtual int StatusCode
+ {
+ get
+ {
+ return 200;
+ }
+ }
+
+ public virtual TimeSpan CacheDuration
+ {
+ get
+ {
+ return TimeSpan.FromTicks(0);
+ }
+ }
+
+ public virtual DateTime? LastDateModified
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public IDictionary<string, string> Headers { get; set; }
+ public Action<Stream> 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