change the http handler of those update* caps to simplehandler
parent
b6a02269f7
commit
d8b182afff
|
@ -308,18 +308,20 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>(
|
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>(
|
||||||
"POST", GetNewCapPath(), NewAgentInventoryRequest, "NewFileAgentInventory", null));
|
"POST", GetNewCapPath(), NewAgentInventoryRequest, "NewFileAgentInventory", null));
|
||||||
|
|
||||||
IRequestHandler req = new RestStreamHandler(
|
// we have a single "do it all" method
|
||||||
"POST", GetNewCapPath(), UpdateInventoryItemAsset, "Update*", null);
|
var oreq = new SimpleOSDMapHandler("POST", GetNewCapPath(), UpdateInventoryItemAsset);
|
||||||
|
|
||||||
|
// first also sets the http handler, others only register the cap, using it
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateNotecardAgentInventory", oreq, true);
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateNotecardTaskInventory", oreq, false); // a object inv
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateAnimSetAgentInventory", oreq, false);
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateScriptAgentInventory", oreq, false);
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateScriptAgent", oreq, false);
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateSettingsAgentInventory", oreq, false);
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateSettingsTaskInventory", oreq, false); // a object inv
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateGestureAgentInventory", oreq, false);
|
||||||
|
m_HostCapsObj.RegisterSimpleHandler("UpdateGestureTaskInventory", oreq, false);
|
||||||
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req);
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateNotecardTaskInventory", req); // a object inv
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req);
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req);
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req);
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateSettingsAgentInventory", req);
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateSettingsTaskInventory", req); // a object inv
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateGestureAgentInventory", req);
|
|
||||||
m_HostCapsObj.RegisterHandler("UpdateGestureTaskInventory", req);
|
|
||||||
|
|
||||||
m_HostCapsObj.RegisterSimpleHandler("UpdateAgentInformation",
|
m_HostCapsObj.RegisterSimpleHandler("UpdateAgentInformation",
|
||||||
new SimpleStreamHandler(GetNewCapPath(), UpdateAgentInformation));
|
new SimpleStreamHandler(GetNewCapPath(), UpdateAgentInformation));
|
||||||
|
@ -1366,25 +1368,21 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="param"></param>
|
/// <param name="param"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string UpdateInventoryItemAsset(string request, string path, string param,
|
public void UpdateInventoryItemAsset(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap map)
|
||||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
|
||||||
{
|
{
|
||||||
m_log.Debug("[CAPS]: UpdateInventoryItemAsset Request in region: " + m_regionName + "\n" + request);
|
m_log.Debug("[CAPS]: UpdateInventoryItemAsset Request in region: " + m_regionName + "\n");
|
||||||
|
|
||||||
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
|
|
||||||
UUID itemID = UUID.Zero;
|
UUID itemID = UUID.Zero;
|
||||||
UUID objectID = UUID.Zero;
|
UUID objectID = UUID.Zero;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OSD oreq = OSDParser.DeserializeLLSDXml(request);
|
if (map.TryGetValue("item_id", out OSD itmp))
|
||||||
if(oreq is OSDMap)
|
itemID = itmp;
|
||||||
{
|
if (map.TryGetValue("task_id", out OSD tmp))
|
||||||
OSDMap map = oreq as OSDMap;
|
objectID = tmp;
|
||||||
if (map.TryGetValue("item_id", out OSD itmp))
|
|
||||||
itemID = itmp;
|
|
||||||
if (map.TryGetValue("task_id", out OSD tmp))
|
|
||||||
objectID = tmp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
|
@ -1393,7 +1391,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
LLSDAssetUploadError error = new LLSDAssetUploadError();
|
LLSDAssetUploadError error = new LLSDAssetUploadError();
|
||||||
error.message = "failed to recode request";
|
error.message = "failed to recode request";
|
||||||
error.identifier = UUID.Zero;
|
error.identifier = UUID.Zero;
|
||||||
return LLSDHelpers.SerialiseLLSDReply(error);
|
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDHelpers.SerialiseLLSDReply(error));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectID != UUID.Zero)
|
if (objectID != UUID.Zero)
|
||||||
|
@ -1404,7 +1403,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
LLSDAssetUploadError error = new LLSDAssetUploadError();
|
LLSDAssetUploadError error = new LLSDAssetUploadError();
|
||||||
error.message = "object not found";
|
error.message = "object not found";
|
||||||
error.identifier = UUID.Zero;
|
error.identifier = UUID.Zero;
|
||||||
return LLSDHelpers.SerialiseLLSDReply(error);
|
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDHelpers.SerialiseLLSDReply(error));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_Scene.Permissions.CanEditObjectInventory(objectID, m_AgentID))
|
if(!m_Scene.Permissions.CanEditObjectInventory(objectID, m_AgentID))
|
||||||
|
@ -1412,7 +1412,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
LLSDAssetUploadError error = new LLSDAssetUploadError();
|
LLSDAssetUploadError error = new LLSDAssetUploadError();
|
||||||
error.message = "No permissions to edit objec";
|
error.message = "No permissions to edit objec";
|
||||||
error.identifier = UUID.Zero;
|
error.identifier = UUID.Zero;
|
||||||
return LLSDHelpers.SerialiseLLSDReply(error);
|
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDHelpers.SerialiseLLSDReply(error));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1436,13 +1437,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// m_log.InfoFormat("[CAPS]: UpdateAgentInventoryAsset response: {0}",
|
// m_log.InfoFormat("[CAPS]: UpdateAgentInventoryAsset response: {0}",
|
||||||
// LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
|
// LLSDHelpers.SerialiseLLSDReply(uploadResponse)));
|
||||||
|
|
||||||
return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
|
httpResponse.RawBuffer = Util.UTF8.GetBytes(LLSDHelpers.SerialiseLLSDReply(uploadResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string CopyInventoryFromNotecardError(IOSHttpResponse response)
|
private string CopyInventoryFromNotecardError(IOSHttpResponse response)
|
||||||
{
|
{
|
||||||
response.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||||
response.StatusDescription = "";
|
response.StatusDescription = "";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue