aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-11-14 21:31:03 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-11-14 21:31:03 -0500
commita4b75934e5a4737ba7721c33ad9a009060a8a246 (patch)
treea738ce7e7a6b707107b438220457d73585d0e4dd /MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs
parent15a56fa069d85382fa2e053a9a60e763308c2d66 (diff)
revise endpoint attributes
Diffstat (limited to 'MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs')
-rw-r--r--MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs b/MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs
new file mode 100644
index 000000000..a33e9c1c6
--- /dev/null
+++ b/MediaBrowser.Controller/Net/ServiceStackServiceRequest.cs
@@ -0,0 +1,62 @@
+using ServiceStack.Web;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+
+namespace MediaBrowser.Controller.Net
+{
+ public class ServiceStackServiceRequest : IServiceRequest
+ {
+ private readonly IRequest _request;
+
+ public ServiceStackServiceRequest(IRequest request)
+ {
+ _request = request;
+ }
+
+ public object OriginalRequest
+ {
+ get { return _request; }
+ }
+
+ public string RemoteIp
+ {
+ get { return _request.RemoteIp; }
+ }
+
+ private NameValueCollection _headers;
+ public NameValueCollection Headers
+ {
+ get { return _headers ?? (_headers = Get(_request.Headers)); }
+ }
+
+ private NameValueCollection _query;
+ public NameValueCollection QueryString
+ {
+ get { return _query ?? (_query = Get(_request.QueryString)); }
+ }
+
+ private NameValueCollection Get(INameValueCollection coll)
+ {
+ var nv = new NameValueCollection(StringComparer.OrdinalIgnoreCase);
+
+ foreach (var key in coll.AllKeys)
+ {
+ nv[key] = coll[key];
+ }
+
+ return nv;
+ //return coll.ToNameValueCollection();
+ }
+
+ public IDictionary<string, object> Items
+ {
+ get { return _request.Items; }
+ }
+
+ public void AddResponseHeader(string name, string value)
+ {
+ _request.Response.AddHeader(name, value);
+ }
+ }
+}