* LLSDStreamhandler now works.

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

View File

@ -31,7 +31,7 @@ namespace OpenSim.Framework.Servers
public abstract byte[] Handle(string path, Stream request); public abstract byte[] Handle(string path, Stream request);
protected BaseStreamHandler(string path, string httpMethod ) protected BaseStreamHandler(string httpMethod, string path)
{ {
m_httpMethod = httpMethod; m_httpMethod = httpMethod;
m_path = path; m_path = path;

View File

@ -23,7 +23,7 @@ namespace OpenSim.Framework.Servers
return Encoding.UTF8.GetBytes(responseString); return Encoding.UTF8.GetBytes(responseString);
} }
public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( path, httpMethod ) public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path )
{ {
m_restMethod = restMethod; m_restMethod = restMethod;
} }

View File

@ -74,10 +74,10 @@ namespace OpenSim.Region.Capabilities
string capsBase = "/CAPS/" + m_capsObjectPath; string capsBase = "/CAPS/" + m_capsObjectPath;
AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer); //AddLegacyCapsHandler( httpListener, m_mapLayerPath, MapLayer);
//httpListener.AddStreamHandler( httpListener.AddStreamHandler(
// new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer )); new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer ));
AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory); AddLegacyCapsHandler(httpListener, m_newInventory, NewAgentInventory);
@ -86,13 +86,6 @@ namespace OpenSim.Region.Capabilities
} }
public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
{
LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
return mapResponse;
}
[Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")]
private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
{ {
@ -151,6 +144,13 @@ namespace OpenSim.Region.Capabilities
return res; return res;
} }
public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
{
LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
return mapResponse;
}
/// <summary> /// <summary>
/// ///

View File

@ -21,18 +21,20 @@ namespace OpenSim.Region.Capabilities
public override byte[] Handle(string path, Stream request) public override byte[] Handle(string path, Stream request)
{ {
Encoding encoding = Encoding.UTF8; //Encoding encoding = Encoding.UTF8;
StreamReader streamReader = new StreamReader(request, encoding); //StreamReader streamReader = new StreamReader(request, false);
string requestBody = streamReader.ReadToEnd(); //string requestBody = streamReader.ReadToEnd();
streamReader.Close(); //streamReader.Close();
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(encoding.GetBytes(requestBody)); Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request );
TRequest llsdRequest = new TRequest(); TRequest llsdRequest = new TRequest();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
TResponse response = m_method(llsdRequest); TResponse response = m_method(llsdRequest);
Encoding encoding = new UTF8Encoding(false);
return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
} }