aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities/Caps.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities/Caps.cs')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs60
1 files changed, 39 insertions, 21 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index cac0571..c9e7507 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -68,15 +68,15 @@ namespace OpenSim.Region.Capabilities
68 private string m_capsObjectPath; 68 private string m_capsObjectPath;
69 public string CapsObjectPath { get { return m_capsObjectPath; } } 69 public string CapsObjectPath { get { return m_capsObjectPath; } }
70 70
71 private string m_requestPath = "0000/"; 71 private static readonly string m_requestPath = "0000/";
72 private string m_mapLayerPath = "0001/"; 72 private static readonly string m_mapLayerPath = "0001/";
73 private string m_newInventory = "0002/"; 73 private static readonly string m_newInventory = "0002/";
74 //private string m_requestTexture = "0003/"; 74 //private static readonly string m_requestTexture = "0003/";
75 private string m_notecardUpdatePath = "0004/"; 75 private static readonly string m_notecardUpdatePath = "0004/";
76 private string m_notecardTaskUpdatePath = "0005/"; 76 private static readonly string m_notecardTaskUpdatePath = "0005/";
77 private string m_fetchInventoryPath = "0006/"; 77 private static readonly string m_fetchInventoryPath = "0006/";
78 private string m_parcelVoiceInfoRequestPath = "0007/"; 78 private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
79 private string m_provisionVoiceAccountRequestPath = "0008/"; 79 private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
80 80
81 //private string eventQueue = "0100/"; 81 //private string eventQueue = "0100/";
82 private BaseHttpServer m_httpListener; 82 private BaseHttpServer m_httpListener;
@@ -94,7 +94,6 @@ namespace OpenSim.Region.Capabilities
94 // 94 //
95 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; 95 public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
96 96
97
98 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, 97 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
99 LLUUID agent, bool dumpAssetsToFile) 98 LLUUID agent, bool dumpAssetsToFile)
100 { 99 {
@@ -108,25 +107,23 @@ namespace OpenSim.Region.Capabilities
108 } 107 }
109 108
110 /// <summary> 109 /// <summary>
111 /// 110 /// Register all CAPS http service handlers
112 /// </summary> 111 /// </summary>
113 public void RegisterHandlers() 112 public void RegisterHandlers()
114 { 113 {
115 string capsBase = "/CAPS/" + m_capsObjectPath; 114 DeregisterHandlers();
115
116 string capsBase = "/CAPS/" + m_capsObjectPath;
116 117
117 try 118 try
118 { 119 {
119 m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath);
120 m_httpListener.AddStreamHandler( 120 m_httpListener.AddStreamHandler(
121 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, 121 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, GetMapLayer));
122 GetMapLayer));
123
124 m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory);
125 m_httpListener.AddStreamHandler( 122 m_httpListener.AddStreamHandler(
126 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", 123 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
127 capsBase + m_newInventory, 124 capsBase + m_newInventory,
128 NewAgentInventoryRequest)); 125 NewAgentInventoryRequest));
129 126
130 // m_httpListener.AddStreamHandler( 127 // m_httpListener.AddStreamHandler(
131 // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", 128 // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
132 // capsBase + m_fetchInventory, 129 // capsBase + m_fetchInventory,
@@ -147,14 +144,35 @@ namespace OpenSim.Region.Capabilities
147 } 144 }
148 } 145 }
149 146
147 /// <summary>
148 /// Remove all CAPS service handlers.
149 ///
150 /// FIXME: Would be much nicer to remove and all paths to a single list. However, this is a little awkward
151 /// than it could be as we set up some handlers differently (legacy and non-legacy)
152 /// </summary>
153 /// <param name="httpListener"></param>
154 /// <param name="path"></param>
155 /// <param name="restMethod"></param>
156 public void DeregisterHandlers()
157 {
158 string capsBase = "/CAPS/" + m_capsObjectPath;
159
160 m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath);
161 m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory);
162 m_httpListener.RemoveStreamHandler("POST", capsBase + m_requestPath);
163 m_httpListener.RemoveStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath);
164 m_httpListener.RemoveStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath);
165 m_httpListener.RemoveStreamHandler("POST", capsBase + m_notecardUpdatePath);
166 m_httpListener.RemoveStreamHandler("POST", capsBase + m_notecardTaskUpdatePath);
167 m_httpListener.RemoveStreamHandler("POST", capsBase + m_fetchInventoryPath);
168 }
150 169
151 //[Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] 170 //[Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")]
152 //Commented out the obsolete as at this time the first caps request can not use the new Caps method 171 //Commented out the obsolete as at this time the first caps request can not use the new Caps method
153 //as the sent type is a array and not a map and the deserialising doesn't deal properly with arrays. 172 //as the sent type is a array and not a map and the deserialising doesn't deal properly with arrays.
154 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) 173 private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod)
155 { 174 {
156 string capsBase = "/CAPS/" + m_capsObjectPath; 175 string capsBase = "/CAPS/" + m_capsObjectPath;
157 httpListener.RemoveStreamHandler("POST", capsBase + path);
158 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 176 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
159 } 177 }
160 178