Merge branch 'master' into careminster

avinationmerge
Melanie 2013-01-23 19:31:22 +00:00
commit 87022b1fb4
2 changed files with 23 additions and 4 deletions

View File

@ -1026,7 +1026,8 @@ namespace OpenSim.Framework.Servers.HttpServer
return buffer; return buffer;
} }
// JsonRpc (v2.0 only) // JsonRpc (v2.0 only)
// Batch requests not yet supported
private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response) private byte[] HandleJsonRpcRequests(OSHttpRequest request, OSHttpResponse response)
{ {
Stream requestStream = request.InputStream; Stream requestStream = request.InputStream;
@ -1066,8 +1067,26 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
jsonRpcHandlers.TryGetValue(methodname, out method); jsonRpcHandlers.TryGetValue(methodname, out method);
} }
bool res = false;
method(jsonRpcRequest, ref jsonRpcResponse); try
{
res = method(jsonRpcRequest, ref jsonRpcResponse);
if(!res)
{
// The handler sent back an unspecified error
if(jsonRpcResponse.Error.Code == 0)
{
jsonRpcResponse.Error.Code = ErrorCode.InternalError;
}
}
}
catch (Exception e)
{
string ErrorMessage = string.Format("[BASE HTTP SERVER]: Json-Rpc Handler Error method {0} - {1}", methodname, e.Message);
m_log.Error(ErrorMessage);
jsonRpcResponse.Error.Code = ErrorCode.InternalError;
jsonRpcResponse.Error.Message = ErrorMessage;
}
} }
else // Error no hanlder defined for requested method else // Error no hanlder defined for requested method
{ {

View File

@ -30,5 +30,5 @@ using OpenMetaverse.StructuredData;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {
public delegate void JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response); public delegate bool JsonRPCMethod(OSDMap jsonRpcRequest, ref JsonRpcResponse response);
} }