Some Caps/LLSD cleaning up.

Sugilite
MW 2007-06-25 19:23:40 +00:00
parent 49b9913210
commit 9a5ec2b84c
3 changed files with 56 additions and 36 deletions

View File

@ -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")]
public class LLSDMapLayer
{
@ -108,10 +133,9 @@ namespace OpenSim.Framework
public int Bottom = 0;
public LLUUID ImageID = LLUUID.Zero;
public LLSDArray TestArray = new LLSDArray();
public LLSDMapLayer()
{
}
}
@ -137,6 +161,7 @@ namespace OpenSim.Framework
}
}
[LLSDType("MAP")]
public class LLSDTest
{
@ -153,12 +178,11 @@ namespace OpenSim.Framework
[AttributeUsage(AttributeTargets.Class)]
public class LLSDType : Attribute
{
private string myHandler;
private string myType;
public LLSDType(string type)
{
myHandler = type;
myType = type;
}
@ -166,7 +190,7 @@ namespace OpenSim.Framework
{
get
{
return myHandler;
return myType;
}
}
}

View File

@ -75,7 +75,7 @@ namespace OpenSim.Servers
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);
if (!this.m_restHandlers.ContainsKey(methodKey))

View File

@ -63,10 +63,9 @@ namespace OpenSim.Region
/// <returns></returns>
public string CapsRequest(string request, string path, string param)
{
Console.WriteLine("Caps Request " + request);
string result = "<llsd><map>";
result += this.GetCapabilities();
result += "</map></llsd>";
// Console.WriteLine("Caps Request " + request);
string result = "";
result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities());
return result;
}
@ -74,15 +73,19 @@ namespace OpenSim.Region
///
/// </summary>
/// <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>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>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>
@ -99,9 +102,12 @@ namespace OpenSim.Region
LLSDMapRequest mapReq = new LLSDMapRequest();
LLSDHelpers.DeserialiseLLSDMap(hash, mapReq );
string res = "<llsd><map><key>AgentData</key><map><key>Flags</key><integer>0</integer></map><key>LayerData</key><array>";
res += this.BuildLLSDMapLayerResponse();
res += "</array></map></llsd>";
LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse();
mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
string res = LLSDHelpers.SerialiseLLSDReply(mapResponse);
//Console.WriteLine(" Maplayer response is " + res);
return res;
}
@ -109,24 +115,14 @@ namespace OpenSim.Region
///
/// </summary>
/// <returns></returns>
protected string BuildLLSDMapLayerResponse()
protected LLSDMapLayer BuildLLSDMapLayerResponse()
{
string res = "";
int left;
int right;
int top;
int bottom;
LLUUID image = null;
LLSDMapLayer mapLayer = new LLSDMapLayer();
mapLayer.Right = 5000;
mapLayer.Top = 5000;
mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006");
left = 0;
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;
return mapLayer;
}
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);
httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath;
Console.WriteLine("uploader url is " + uploaderURL);
//Console.WriteLine("uploader url is " + uploaderURL);
res += "<llsd><map>";
res += "<key>uploader</key><string>" + uploaderURL + "</string>";
//res += "<key>success</key><boolean>true</boolean>";
@ -244,7 +240,7 @@ namespace OpenSim.Region
res += "<key>state</key><string>complete</string>";
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);
if (OnUpLoad != null)
{