Some Caps/LLSD cleaning up.
parent
49b9913210
commit
9a5ec2b84c
|
@ -99,6 +99,31 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[LLSDType("MAP")]
|
||||||
|
public class LLSDMapLayerResponse
|
||||||
|
{
|
||||||
|
public LLSDMapRequest AgentData = new LLSDMapRequest();
|
||||||
|
public LLSDArray LayerData = new LLSDArray();
|
||||||
|
|
||||||
|
public LLSDMapLayerResponse()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[LLSDType("MAP")]
|
||||||
|
public class LLSDCapsDetails
|
||||||
|
{
|
||||||
|
public string MapLayer = "";
|
||||||
|
public string NewFileAgentInventory = "";
|
||||||
|
//public string EventQueueGet = "";
|
||||||
|
|
||||||
|
public LLSDCapsDetails()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[LLSDType("MAP")]
|
[LLSDType("MAP")]
|
||||||
public class LLSDMapLayer
|
public class LLSDMapLayer
|
||||||
{
|
{
|
||||||
|
@ -108,10 +133,9 @@ namespace OpenSim.Framework
|
||||||
public int Bottom = 0;
|
public int Bottom = 0;
|
||||||
public LLUUID ImageID = LLUUID.Zero;
|
public LLUUID ImageID = LLUUID.Zero;
|
||||||
|
|
||||||
public LLSDArray TestArray = new LLSDArray();
|
|
||||||
public LLSDMapLayer()
|
public LLSDMapLayer()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +161,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[LLSDType("MAP")]
|
[LLSDType("MAP")]
|
||||||
public class LLSDTest
|
public class LLSDTest
|
||||||
{
|
{
|
||||||
|
@ -153,12 +178,11 @@ namespace OpenSim.Framework
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class LLSDType : Attribute
|
public class LLSDType : Attribute
|
||||||
{
|
{
|
||||||
private string myHandler;
|
private string myType;
|
||||||
|
|
||||||
|
|
||||||
public LLSDType(string type)
|
public LLSDType(string type)
|
||||||
{
|
{
|
||||||
myHandler = type;
|
myType = type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +190,7 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return myHandler;
|
return myType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace OpenSim.Servers
|
||||||
|
|
||||||
public bool AddRestHandler(string method, string path, RestMethod handler)
|
public bool AddRestHandler(string method, string path, RestMethod handler)
|
||||||
{
|
{
|
||||||
Console.WriteLine("adding new REST handler for path " + path);
|
//Console.WriteLine("adding new REST handler for path " + path);
|
||||||
string methodKey = String.Format("{0}: {1}", method, path);
|
string methodKey = String.Format("{0}: {1}", method, path);
|
||||||
|
|
||||||
if (!this.m_restHandlers.ContainsKey(methodKey))
|
if (!this.m_restHandlers.ContainsKey(methodKey))
|
||||||
|
|
|
@ -63,10 +63,9 @@ namespace OpenSim.Region
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string CapsRequest(string request, string path, string param)
|
public string CapsRequest(string request, string path, string param)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Caps Request " + request);
|
// Console.WriteLine("Caps Request " + request);
|
||||||
string result = "<llsd><map>";
|
string result = "";
|
||||||
result += this.GetCapabilities();
|
result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities());
|
||||||
result += "</map></llsd>";
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,15 +73,19 @@ namespace OpenSim.Region
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected string GetCapabilities()
|
protected LLSDCapsDetails GetCapabilities()
|
||||||
{
|
{
|
||||||
string capURLS = "";
|
/* string capURLS = "";
|
||||||
|
|
||||||
capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
|
capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
|
||||||
capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
|
capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
|
||||||
//capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
|
//capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
|
||||||
//capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>";
|
//capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>";
|
||||||
return capURLS;
|
return capURLS;*/
|
||||||
|
|
||||||
|
LLSDCapsDetails caps = new LLSDCapsDetails();
|
||||||
|
caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath;
|
||||||
|
caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory;
|
||||||
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -99,9 +102,12 @@ namespace OpenSim.Region
|
||||||
LLSDMapRequest mapReq = new LLSDMapRequest();
|
LLSDMapRequest mapReq = new LLSDMapRequest();
|
||||||
LLSDHelpers.DeserialiseLLSDMap(hash, mapReq );
|
LLSDHelpers.DeserialiseLLSDMap(hash, mapReq );
|
||||||
|
|
||||||
string res = "<llsd><map><key>AgentData</key><map><key>Flags</key><integer>0</integer></map><key>LayerData</key><array>";
|
LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse();
|
||||||
res += this.BuildLLSDMapLayerResponse();
|
mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
|
||||||
res += "</array></map></llsd>";
|
string res = LLSDHelpers.SerialiseLLSDReply(mapResponse);
|
||||||
|
|
||||||
|
//Console.WriteLine(" Maplayer response is " + res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,24 +115,14 @@ namespace OpenSim.Region
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected string BuildLLSDMapLayerResponse()
|
protected LLSDMapLayer BuildLLSDMapLayerResponse()
|
||||||
{
|
{
|
||||||
string res = "";
|
LLSDMapLayer mapLayer = new LLSDMapLayer();
|
||||||
int left;
|
mapLayer.Right = 5000;
|
||||||
int right;
|
mapLayer.Top = 5000;
|
||||||
int top;
|
mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
|
||||||
int bottom;
|
|
||||||
LLUUID image = null;
|
|
||||||
|
|
||||||
left = 0;
|
return mapLayer;
|
||||||
bottom = 0;
|
|
||||||
top = 5000;
|
|
||||||
right = 5000;
|
|
||||||
image = new LLUUID("00000000-0000-0000-9999-000000000006");
|
|
||||||
|
|
||||||
res += "<map><key>Left</key><integer>" + left + "</integer><key>Bottom</key><integer>" + bottom + "</integer><key>Top</key><integer>" + top + "</integer><key>Right</key><integer>" + right + "</integer><key>ImageID</key><uuid>" + image.ToStringHyphenated() + "</uuid></map>";
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ProcessEventQueue(string request, string path, string param)
|
public string ProcessEventQueue(string request, string path, string param)
|
||||||
|
@ -191,7 +187,7 @@ namespace OpenSim.Region
|
||||||
AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener);
|
AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener);
|
||||||
httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
|
httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
|
||||||
string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath;
|
string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath;
|
||||||
Console.WriteLine("uploader url is " + uploaderURL);
|
//Console.WriteLine("uploader url is " + uploaderURL);
|
||||||
res += "<llsd><map>";
|
res += "<llsd><map>";
|
||||||
res += "<key>uploader</key><string>" + uploaderURL + "</string>";
|
res += "<key>uploader</key><string>" + uploaderURL + "</string>";
|
||||||
//res += "<key>success</key><boolean>true</boolean>";
|
//res += "<key>success</key><boolean>true</boolean>";
|
||||||
|
@ -244,7 +240,7 @@ namespace OpenSim.Region
|
||||||
res += "<key>state</key><string>complete</string>";
|
res += "<key>state</key><string>complete</string>";
|
||||||
res += "</map></llsd>";
|
res += "</map></llsd>";
|
||||||
|
|
||||||
Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated());
|
// Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated());
|
||||||
httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath);
|
httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath);
|
||||||
if (OnUpLoad != null)
|
if (OnUpLoad != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue