mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
* re-fixed the utf-16 bug in xmlRpcResponse serialization
* added LLSDStreamHandler.cs to Caps (Haven't enabled it yet, though) * removed last traces of old rest handling
This commit is contained in:
@@ -2,40 +2,9 @@ using System.Collections;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
using OpenSim.Region.Capabilities;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenSim.Framework.Servers
|
||||
{
|
||||
public class LlsdMethodEntry<TResponse, TRequest> : ILlsdMethodHandler
|
||||
where TRequest : new()
|
||||
{
|
||||
private LlsdMethod<TResponse, TRequest> m_method;
|
||||
|
||||
|
||||
public LlsdMethodEntry( )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LlsdMethodEntry(LlsdMethod<TResponse, TRequest> method)
|
||||
{
|
||||
m_method = method;
|
||||
}
|
||||
|
||||
#region ILlsdMethodHandler Members
|
||||
|
||||
public string Handle(string body, string path)
|
||||
{
|
||||
Encoding _enc = Encoding.UTF8;
|
||||
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(_enc.GetBytes( body ));
|
||||
TRequest request = new TRequest();
|
||||
|
||||
LLSDHelpers.DeserialiseLLSDMap(hash, request );
|
||||
|
||||
TResponse response = m_method(request);
|
||||
|
||||
return LLSDHelpers.SerialiseLLSDReply( response );
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,8 +60,6 @@ namespace SimpleApp
|
||||
|
||||
httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod );
|
||||
|
||||
RegisterLlsdHandler<LLSDMapLayerResponse, LLSDMapRequest>("/Caps/test/", LlsdMethodDemo);
|
||||
|
||||
httpServer.Start();
|
||||
|
||||
m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
|
||||
@@ -74,27 +72,6 @@ namespace SimpleApp
|
||||
|
||||
}
|
||||
|
||||
private LLSDMapLayerResponse LlsdMethodDemo(LLSDMapRequest request)
|
||||
{
|
||||
return new LLSDMapLayerResponse();
|
||||
}
|
||||
|
||||
ILlsdMethodHandler m_handler;
|
||||
|
||||
private void RegisterLlsdHandler<TResponse, TRequest>( string path, LlsdMethod<TResponse, TRequest> method )
|
||||
where TRequest : new()
|
||||
{
|
||||
// path should be handler key, but for now just conceptually store it.
|
||||
m_handler = new LlsdMethodEntry<TResponse, TRequest>( method );
|
||||
}
|
||||
|
||||
private string ProcessLlsdMethod( string request,string path )
|
||||
{
|
||||
LlsdMethodEntry<LLSDMapLayerResponse, LLSDMapRequest> concreteHandler = new LlsdMethodEntry<LLSDMapLayerResponse, LLSDMapRequest>( LlsdMethodDemo );
|
||||
|
||||
return m_handler.Handle(request, path);
|
||||
}
|
||||
|
||||
private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
|
||||
{
|
||||
m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
|
||||
|
||||
Reference in New Issue
Block a user