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