diff options
author | Adam Frisby | 2007-07-11 08:10:25 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:10:25 +0000 |
commit | e2ff441e31328e60c8bb1d4bb32fa4ac64f91978 (patch) | |
tree | 8405b6cef57b66a58f31a24c859846085d0b81f7 /OpenSim/Framework/Servers/RestStreamHandler.cs | |
parent | * Wiping trunk in prep for Sugilite (diff) | |
parent | * Applying dalien's patches from bug#177 and #179 (diff) | |
download | opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.zip opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.gz opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.bz2 opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.xz |
* Bringing Sugilite in to trunk
Diffstat (limited to 'OpenSim/Framework/Servers/RestStreamHandler.cs')
-rw-r--r-- | OpenSim/Framework/Servers/RestStreamHandler.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs new file mode 100644 index 0000000..1b3b41c --- /dev/null +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.IO; | ||
5 | |||
6 | namespace OpenSim.Framework.Servers | ||
7 | { | ||
8 | public class RestStreamHandler : BaseStreamHandler | ||
9 | { | ||
10 | RestMethod m_restMethod; | ||
11 | |||
12 | override public byte[] Handle(string path, Stream request ) | ||
13 | { | ||
14 | Encoding encoding = Encoding.UTF8; | ||
15 | StreamReader streamReader = new StreamReader(request, encoding); | ||
16 | |||
17 | string requestBody = streamReader.ReadToEnd(); | ||
18 | streamReader.Close(); | ||
19 | |||
20 | string param = GetParam(path); | ||
21 | string responseString = m_restMethod(requestBody, path, param ); | ||
22 | |||
23 | return Encoding.UTF8.GetBytes(responseString); | ||
24 | } | ||
25 | |||
26 | public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path ) | ||
27 | { | ||
28 | m_restMethod = restMethod; | ||
29 | } | ||
30 | } | ||
31 | } | ||