aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/RestStreamHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs34
1 files changed, 32 insertions, 2 deletions
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs
index 145a184..64d6ea3 100644
--- a/OpenSim/Framework/Servers/RestStreamHandler.cs
+++ b/OpenSim/Framework/Servers/RestStreamHandler.cs
@@ -7,9 +7,39 @@ namespace OpenSim.Framework.Servers
7{ 7{
8 public class RestStreamHandler : IStreamHandler 8 public class RestStreamHandler : IStreamHandler
9 { 9 {
10 public void Handle( string path, Stream request, Stream response ) 10 RestMethod m_restMethod;
11
12 private string m_contentType;
13 public string ContentType
14 {
15 get { return m_contentType; }
16 }
17
18 private string m_httpMethod;
19 public string HttpMethod
20 {
21 get { return m_httpMethod; }
22 }
23
24
25 public byte[] Handle(string path, Stream request )
26 {
27 Encoding encoding = Encoding.UTF8;
28 StreamReader reader = new StreamReader(request, encoding);
29
30 string requestBody = reader.ReadToEnd();
31 reader.Close();
32
33 string responseString = m_restMethod(requestBody, path, m_httpMethod);
34
35 return Encoding.UTF8.GetBytes(responseString);
36 }
37
38 public RestStreamHandler(RestMethod restMethod, string httpMethod, string contentType)
11 { 39 {
12 40 m_restMethod = restMethod;
41 m_httpMethod = httpMethod;
42 m_contentType = contentType;
13 } 43 }
14 } 44 }
15} 45}