aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/RestStreamHandler.cs
diff options
context:
space:
mode:
authorlbsa712007-07-04 14:12:32 +0000
committerlbsa712007-07-04 14:12:32 +0000
commit6a2588454a1ac4bb484ad0b9ee648e9ac156f8db (patch)
treefd4e0d33f65e36365d15d991f95d323e6d15e8b1 /OpenSim/Framework/Servers/RestStreamHandler.cs
parent* Added StreamHandler support (diff)
downloadopensim-SC_OLD-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.zip
opensim-SC_OLD-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.tar.gz
opensim-SC_OLD-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.tar.bz2
opensim-SC_OLD-6a2588454a1ac4bb484ad0b9ee648e9ac156f8db.tar.xz
* Removed AssetHttpServer, using BaseHttpServer instead
* Removed legacy REST handling * Created two custom IStreamHandlers for asset up/download * Removed quite a lot of double and triple encodings, trying to work towards binary only and direct write into storage. * Introduced BaseStreamHandler with GetParam() and some other goodies
Diffstat (limited to 'OpenSim/Framework/Servers/RestStreamHandler.cs')
-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}