* LLSDStreamhandler now works.

This commit is contained in:
lbsa71
2007-07-09 23:32:29 +00:00
parent 19c01bfb52
commit 9f5f65c847
4 changed files with 20 additions and 18 deletions

View File

@@ -14,25 +14,27 @@ namespace OpenSim.Region.Capabilities
private LLSDMethod<TRequest, TResponse> m_method;
public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
: base(httpMethod, path)
: base(httpMethod, path )
{
m_method = method;
}
public override byte[] Handle(string path, Stream request)
{
Encoding encoding = Encoding.UTF8;
StreamReader streamReader = new StreamReader(request, encoding);
//Encoding encoding = Encoding.UTF8;
//StreamReader streamReader = new StreamReader(request, false);
string requestBody = streamReader.ReadToEnd();
streamReader.Close();
//string requestBody = streamReader.ReadToEnd();
//streamReader.Close();
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody));
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request );
TRequest llsdRequest = new TRequest();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
TResponse response = m_method(llsdRequest);
Encoding encoding = new UTF8Encoding(false);
return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
}