move a few more caps to simpleStreamHandler
parent
7856192da6
commit
3d09ff57f0
|
@ -265,17 +265,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// GetNewCapPath(),
|
// GetNewCapPath(),
|
||||||
// GetMapLayer);
|
// GetMapLayer);
|
||||||
|
|
||||||
IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler(
|
m_HostCapsObj.RegisterSimpleHandler("GetObjectPhysicsData",
|
||||||
"POST", GetNewCapPath(), GetObjectPhysicsData, "GetObjectPhysicsData", null);
|
new SimpleStreamHandler(GetNewCapPath(), GetObjectPhysicsData));
|
||||||
m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler);
|
|
||||||
|
|
||||||
IRequestHandler getObjectCostHandler = new RestStreamHandler(
|
m_HostCapsObj.RegisterSimpleHandler("GetObjectCost",
|
||||||
"POST", GetNewCapPath(), GetObjectCost, "GetObjectCost", null );
|
new SimpleStreamHandler(GetNewCapPath(), GetObjectCost));
|
||||||
m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler);
|
|
||||||
|
|
||||||
IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler(
|
m_HostCapsObj.RegisterSimpleHandler("ResourceCostSelected",
|
||||||
"POST", GetNewCapPath(), ResourceCostSelected, "ResourceCostSelected", null);
|
new SimpleStreamHandler(GetNewCapPath(), ResourceCostSelected));
|
||||||
m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler);
|
|
||||||
|
|
||||||
IRequestHandler req = new RestStreamHandler(
|
IRequestHandler req = new RestStreamHandler(
|
||||||
"POST", GetNewCapPath(), ScriptTaskInventory, "UpdateScript", null);
|
"POST", GetNewCapPath(), ScriptTaskInventory, "UpdateScript", null);
|
||||||
|
@ -284,9 +281,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
if(m_AllowCapHomeLocation)
|
if(m_AllowCapHomeLocation)
|
||||||
{
|
{
|
||||||
IRequestHandler HomeLocationHandler = new RestStreamHandler(
|
m_HostCapsObj.RegisterSimpleHandler("HomeLocation",
|
||||||
"POST", GetNewCapPath(), HomeLocation, "HomeLocation", null);
|
new SimpleStreamHandler(GetNewCapPath(), HomeLocation));
|
||||||
m_HostCapsObj.RegisterHandler("HomeLocation", HomeLocationHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_AllowCapGroupMemberData)
|
if(m_AllowCapGroupMemberData)
|
||||||
|
@ -463,10 +459,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
new BinaryStreamHandler(
|
new BinaryStreamHandler(
|
||||||
"POST", uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null));
|
"POST", uploaderPath, uploader.uploaderCaps, "TaskInventoryScriptUpdater", null));
|
||||||
|
|
||||||
string protocol = "http://";
|
string protocol = m_HostCapsObj.SSLCaps ? "https://" : "http://";
|
||||||
|
|
||||||
if (m_HostCapsObj.SSLCaps)
|
|
||||||
protocol = "https://";
|
|
||||||
|
|
||||||
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
|
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" + m_HostCapsObj.Port.ToString() + uploaderPath;
|
||||||
|
|
||||||
|
@ -1626,12 +1619,25 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetObjectPhysicsData(string request, string path,
|
public void GetObjectPhysicsData(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
string param, IOSHttpRequest httpRequest,
|
|
||||||
IOSHttpResponse httpResponse)
|
|
||||||
{
|
{
|
||||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
if(httpRequest.HttpMethod != "POST")
|
||||||
OSDArray object_ids = (OSDArray)req["object_ids"];
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OSDMap req;
|
||||||
|
OSDArray object_ids;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
req = (OSDMap)OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||||
|
object_ids = (OSDArray)req["object_ids"];
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder lsl = LLSDxmlEncode.Start();
|
StringBuilder lsl = LLSDxmlEncode.Start();
|
||||||
|
|
||||||
|
@ -1661,15 +1667,30 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LLSDxmlEncode.End(lsl);
|
httpResponse.RawBuffer = Encoding.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetObjectCost(string request, string path,
|
public void GetObjectCost(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
string param, IOSHttpRequest httpRequest,
|
|
||||||
IOSHttpResponse httpResponse)
|
|
||||||
{
|
{
|
||||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
if (httpRequest.HttpMethod != "POST")
|
||||||
OSDArray object_ids = (OSDArray)req["object_ids"];
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OSDMap req;
|
||||||
|
OSDArray object_ids;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
req = (OSDMap)OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||||
|
object_ids = (OSDArray)req["object_ids"];
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder lsl = LLSDxmlEncode.Start(512);
|
StringBuilder lsl = LLSDxmlEncode.Start(512);
|
||||||
|
|
||||||
|
@ -1721,14 +1742,28 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
LLSDxmlEncode.AddEndMap(lsl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LLSDxmlEncode.End(lsl);
|
httpResponse.RawBuffer = Encoding.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ResourceCostSelected(string request, string path,
|
public void ResourceCostSelected(IOSHttpRequest httpRequest,IOSHttpResponse httpResponse)
|
||||||
string param, IOSHttpRequest httpRequest,
|
|
||||||
IOSHttpResponse httpResponse)
|
|
||||||
{
|
{
|
||||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
if (httpRequest.HttpMethod != "POST")
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OSDMap req;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
req = (OSDMap)OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float phys=0;
|
float phys=0;
|
||||||
float stream=0;
|
float stream=0;
|
||||||
|
@ -1791,9 +1826,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
LLSDxmlEncode.AddEndMap(lsl);
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
LLSDxmlEncode.AddEndMap(lsl);
|
||||||
|
|
||||||
// resp["transaction_id"] = "undef";
|
// resp["transaction_id"] = "undef";
|
||||||
return LLSDxmlEncode.End(lsl);
|
httpResponse.RawBuffer = Encoding.UTF8.GetBytes(LLSDxmlEncode.End(lsl));
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string UpdateAgentInformation(string request, string path,
|
public string UpdateAgentInformation(string request, string path,
|
||||||
|
@ -1827,17 +1862,17 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string HomeLocation(string request, string path, string param, IOSHttpRequest httpRequest,
|
public void HomeLocation(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||||
IOSHttpResponse httpResponse)
|
|
||||||
{
|
{
|
||||||
OSDMap resp = new OSDMap();
|
if (httpRequest.HttpMethod != "POST")
|
||||||
|
{
|
||||||
resp["success"] = "false";
|
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool fail = true;
|
bool fail = true;
|
||||||
string message = "Set Home request failed";
|
string message = "Set Home request failed";
|
||||||
int locationID = 1;
|
//int locationID = 1;
|
||||||
Vector3 pos = Vector3.Zero;
|
Vector3 pos = Vector3.Zero;
|
||||||
Vector3 lookAt = Vector3.Zero;
|
Vector3 lookAt = Vector3.Zero;
|
||||||
|
|
||||||
|
@ -1864,23 +1899,34 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
if(!m_Scene.UserManagementModule.IsLocalGridUser(m_AgentID))
|
if(!m_Scene.UserManagementModule.IsLocalGridUser(m_AgentID))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
OSDMap req;
|
||||||
if(!req.ContainsKey("HomeLocation"))
|
try
|
||||||
|
{
|
||||||
|
req = (OSDMap)OSDParser.DeserializeLLSDXml(httpRequest.InputStream);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OSD tmp;
|
||||||
|
if (!req.TryGetValue("HomeLocation", out tmp) || !(tmp is OSDMap))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
OSDMap HLocation = (OSDMap)req["HomeLocation"];
|
OSDMap HLocation = (OSDMap)tmp;
|
||||||
if(!HLocation.ContainsKey("LocationPos"))
|
|
||||||
|
if(!HLocation.TryGetValue("LocationPos", out tmp) || !(tmp is OSDMap))
|
||||||
break;
|
break;
|
||||||
if(!HLocation.ContainsKey("LocationLookAt"))
|
if (!OSDMapTOVector3((OSDMap)tmp, out pos))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
locationID = HLocation["LocationId"].AsInteger();
|
if (!HLocation.TryGetValue("LocationLookAt", out tmp) || !(tmp is OSDMap))
|
||||||
|
break;
|
||||||
if(!OSDMapTOVector3((OSDMap)HLocation["LocationPos"], out pos))
|
if (!OSDMapTOVector3((OSDMap)tmp, out lookAt))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(!OSDMapTOVector3((OSDMap)HLocation["LocationLookAt"], out lookAt))
|
//locationID = HLocation["LocationId"].AsInteger();
|
||||||
break;
|
|
||||||
|
|
||||||
ILandObject land = m_Scene.LandChannel.GetLandObject(pos);
|
ILandObject land = m_Scene.LandChannel.GetLandObject(pos);
|
||||||
if(land == null)
|
if(land == null)
|
||||||
|
@ -1924,33 +1970,34 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
string response;
|
OSDMap resp = new OSDMap();
|
||||||
|
|
||||||
if(fail)
|
if(fail)
|
||||||
{
|
{
|
||||||
if(client != null)
|
if(client != null)
|
||||||
client.SendAlertMessage(message);
|
client.SendAlertMessage(message);
|
||||||
response = OSDParser.SerializeLLSDXmlString(resp);
|
resp["success"] = "false";
|
||||||
return response;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// so its http but still needs a udp reply to inform user? crap :p
|
||||||
|
if(client != null)
|
||||||
|
client.SendAlertMessage("Home position set.","HomePositionSet");
|
||||||
|
|
||||||
|
resp["success"] = "true";
|
||||||
|
OSDMap homeloc = new OSDMap();
|
||||||
|
OSDMap homelocpos = new OSDMap();
|
||||||
|
// for some odd reason viewers send pos as reals but read as integer
|
||||||
|
homelocpos["X"] = new OSDReal(pos.X);
|
||||||
|
homelocpos["Y"] = new OSDReal(pos.Y);
|
||||||
|
homelocpos["Z"] = new OSDReal(pos.Z);
|
||||||
|
homeloc["LocationPos"] = homelocpos;
|
||||||
|
|
||||||
|
resp["HomeLocation"] = homeloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// so its http but still needs a udp reply to inform user? crap :p
|
httpResponse.RawBuffer = Encoding.UTF8.GetBytes(OSDParser.SerializeLLSDXmlString(resp));
|
||||||
if(client != null)
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
client.SendAlertMessage("Home position set.","HomePositionSet");
|
|
||||||
|
|
||||||
resp["success"] = "true";
|
|
||||||
OSDMap homeloc = new OSDMap();
|
|
||||||
OSDMap homelocpos = new OSDMap();
|
|
||||||
// for some odd reason viewers send pos as reals but read as integer
|
|
||||||
homelocpos["X"] = new OSDReal(pos.X);
|
|
||||||
homelocpos["Y"] = new OSDReal(pos.Y);
|
|
||||||
homelocpos["Z"] = new OSDReal(pos.Z);
|
|
||||||
homeloc["LocationPos"] = homelocpos;
|
|
||||||
|
|
||||||
resp["HomeLocation"] = homeloc;
|
|
||||||
|
|
||||||
response = OSDParser.SerializeLLSDXmlString(resp);
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int CompareRolesByMembersDesc(GroupRolesData x, GroupRolesData y)
|
private static int CompareRolesByMembersDesc(GroupRolesData x, GroupRolesData y)
|
||||||
|
|
Loading…
Reference in New Issue