aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Capabilities
diff options
context:
space:
mode:
authorlbsa712007-07-04 11:47:32 +0000
committerlbsa712007-07-04 11:47:32 +0000
commit9a51949cb4c833dcacf2a5803a8f2753273941c8 (patch)
tree698f58d78bc8bc20b3d82c7683723fe2c9eacca7 /OpenSim/Region/Capabilities
parentGrid Servers: (diff)
downloadopensim-SC-9a51949cb4c833dcacf2a5803a8f2753273941c8.zip
opensim-SC-9a51949cb4c833dcacf2a5803a8f2753273941c8.tar.gz
opensim-SC-9a51949cb4c833dcacf2a5803a8f2753273941c8.tar.bz2
opensim-SC-9a51949cb4c833dcacf2a5803a8f2753273941c8.tar.xz
* Added StreamHandler support
* Implemented RestStreamHandler * Some caps functions now use it * Moved out RestMethodEntry from httpserver * The IStreamHandler interface now reports required method and Content-Type
Diffstat (limited to 'OpenSim/Region/Capabilities')
-rw-r--r--OpenSim/Region/Capabilities/Caps.cs47
1 files changed, 27 insertions, 20 deletions
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs
index 4a283b2..0f6c471 100644
--- a/OpenSim/Region/Capabilities/Caps.cs
+++ b/OpenSim/Region/Capabilities/Caps.cs
@@ -41,13 +41,13 @@ namespace OpenSim.Region.Capabilities
41 41
42 public class Caps 42 public class Caps
43 { 43 {
44 private string httpListenerHostName; 44 private string m_httpListenerHostName;
45 private int httpListenPort; 45 private int m_httpListenPort;
46 private string capsObjectPath = "00001-"; 46 private string m_capsObjectPath = "00001-";
47 private string requestPath = "0000/"; 47 private string m_requestPath = "0000/";
48 private string mapLayerPath = "0001/"; 48 private string m_mapLayerPath = "0001/";
49 private string newInventory = "0002/"; 49 private string m_newInventory = "0002/";
50 private string requestTexture = "0003/"; 50 private string m_requestTexture = "0003/";
51 private string eventQueue = "0100/"; 51 private string eventQueue = "0100/";
52 private BaseHttpServer httpListener; 52 private BaseHttpServer httpListener;
53 private LLUUID agentID; 53 private LLUUID agentID;
@@ -58,10 +58,10 @@ namespace OpenSim.Region.Capabilities
58 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) 58 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent)
59 { 59 {
60 assetCache = assetCach; 60 assetCache = assetCach;
61 capsObjectPath = capsPath; 61 m_capsObjectPath = capsPath;
62 httpListener = httpServer; 62 httpListener = httpServer;
63 httpListenerHostName = httpListen; 63 m_httpListenerHostName = httpListen;
64 httpListenPort = httpPort; 64 m_httpListenPort = httpPort;
65 agentID = agent; 65 agentID = agent;
66 } 66 }
67 67
@@ -71,13 +71,20 @@ namespace OpenSim.Region.Capabilities
71 public void RegisterHandlers() 71 public void RegisterHandlers()
72 { 72 {
73 Console.WriteLine("registering CAPS handlers"); 73 Console.WriteLine("registering CAPS handlers");
74 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); 74
75 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); 75 AddCapsHandler( httpListener, m_requestPath, CapsRequest);
76 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); 76 AddCapsHandler( httpListener, m_mapLayerPath, MapLayer);
77 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); 77 AddCapsHandler( httpListener, m_newInventory, NewAgentInventory);
78 httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestTexture, RequestTexture); 78 AddCapsHandler( httpListener, eventQueue, ProcessEventQueue);
79 AddCapsHandler( httpListener, m_requestTexture, RequestTexture);
79 } 80 }
80 81
82 private void AddCapsHandler( BaseHttpServer httpListener, string path, RestMethod restMethod )
83 {
84 string capsBase = "/CAPS/" + m_capsObjectPath;
85 httpListener.AddStreamHandler(capsBase + path, new RestStreamHandler(restMethod, "POST", "application/xml"));
86 }
87
81 /// <summary> 88 /// <summary>
82 /// 89 ///
83 /// </summary> 90 /// </summary>
@@ -100,10 +107,10 @@ namespace OpenSim.Region.Capabilities
100 protected LLSDCapsDetails GetCapabilities() 107 protected LLSDCapsDetails GetCapabilities()
101 { 108 {
102 LLSDCapsDetails caps = new LLSDCapsDetails(); 109 LLSDCapsDetails caps = new LLSDCapsDetails();
103 string capsBaseUrl = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath; 110 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath;
104 111
105 caps.MapLayer = capsBaseUrl + mapLayerPath; 112 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
106 caps.NewFileAgentInventory = capsBaseUrl + newInventory; 113 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
107 114
108 return caps; 115 return caps;
109 } 116 }
@@ -204,10 +211,10 @@ namespace OpenSim.Region.Capabilities
204 string res = ""; 211 string res = "";
205 LLUUID newAsset = LLUUID.Random(); 212 LLUUID newAsset = LLUUID.Random();
206 LLUUID newInvItem = LLUUID.Random(); 213 LLUUID newInvItem = LLUUID.Random();
207 string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); 214 string uploaderPath = m_capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000");
208 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); 215 AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener);
209 httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); 216 httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps);
210 string uploaderURL = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; 217 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath;
211 //Console.WriteLine("uploader url is " + uploaderURL); 218 //Console.WriteLine("uploader url is " + uploaderURL);
212 res += "<llsd><map>"; 219 res += "<llsd><map>";
213 res += "<key>uploader</key><string>" + uploaderURL + "</string>"; 220 res += "<key>uploader</key><string>" + uploaderURL + "</string>";