aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
diff options
context:
space:
mode:
authorDr Scofield2008-09-18 15:49:52 +0000
committerDr Scofield2008-09-18 15:49:52 +0000
commit978b8af77702f1e2129ad18e247273a8dd20778d (patch)
tree423d9f85844f4b5d79044fc95e1973369aa1c626 /OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
parentadds support to delete a region completely and offers that (diff)
downloadopensim-SC_OLD-978b8af77702f1e2129ad18e247273a8dd20778d.zip
opensim-SC_OLD-978b8af77702f1e2129ad18e247273a8dd20778d.tar.gz
opensim-SC_OLD-978b8af77702f1e2129ad18e247273a8dd20778d.tar.bz2
opensim-SC_OLD-978b8af77702f1e2129ad18e247273a8dd20778d.tar.xz
Adds REST interface for setting avatar appearance. cleans up a couple
of places in the REST inventory code.
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs25
1 files changed, 17 insertions, 8 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
index ab6128f..126b757 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
@@ -123,7 +123,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
123 /// construction, or during initialization. 123 /// construction, or during initialization.
124 /// 124 ///
125 /// I was not able to make this code work within a constructor 125 /// I was not able to make this code work within a constructor
126 /// so it is islated within this method. 126 /// so it is isolated within this method.
127 /// </summary> 127 /// </summary>
128 128
129 private void LoadHandlers() 129 private void LoadHandlers()
@@ -222,7 +222,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
222 return; 222 return;
223 } 223 }
224 224
225 Rest.Log.InfoFormat("{0} Plugin will be enabled", MsgId); 225 Rest.Log.InfoFormat("{0} Rest <{1}> plugin will be enabled", MsgId, Name);
226 Rest.Log.InfoFormat("{0} Configuration parameters read from <{1}>", MsgId, ConfigName);
226 227
227 // These are stored in static variables to make 228 // These are stored in static variables to make
228 // them easy to reach from anywhere in the assembly. 229 // them easy to reach from anywhere in the assembly.
@@ -233,6 +234,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
233 Rest.UserServices = Rest.Comms.UserService; 234 Rest.UserServices = Rest.Comms.UserService;
234 Rest.InventoryServices = Rest.Comms.InventoryService; 235 Rest.InventoryServices = Rest.Comms.InventoryService;
235 Rest.AssetServices = Rest.Comms.AssetCache; 236 Rest.AssetServices = Rest.Comms.AssetCache;
237 Rest.AvatarServices = Rest.Comms.AvatarService;
236 Rest.Config = Config; 238 Rest.Config = Config;
237 Rest.Prefix = Prefix; 239 Rest.Prefix = Prefix;
238 Rest.GodKey = GodKey; 240 Rest.GodKey = GodKey;
@@ -261,15 +263,18 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
261 // The supplied prefix MUST be absolute 263 // The supplied prefix MUST be absolute
262 264
263 if (Rest.Prefix.Substring(0,1) != Rest.UrlPathSeparator) 265 if (Rest.Prefix.Substring(0,1) != Rest.UrlPathSeparator)
264 Rest.Prefix = Rest.UrlPathSeparator+Rest.Prefix; 266 {
267 Rest.Log.WarnFormat("{0} Prefix <{1}> is not absolute and must be", MsgId, Rest.Prefix);
268 Rest.Log.InfoFormat("{0} Prefix changed to </{1}>", MsgId, Rest.Prefix);
269 Rest.Prefix = String.Format("{0}{1}", Rest.UrlPathSeparator, Rest.Prefix);
270 }
265 271
266 // If data dumping is requested, report on the chosen line 272 // If data dumping is requested, report on the chosen line
267 // length. 273 // length.
268 274
269 if (Rest.DumpAsset) 275 if (Rest.DumpAsset)
270 { 276 {
271 Rest.Log.InfoFormat("{0} Dump {1} bytes per line", MsgId, 277 Rest.Log.InfoFormat("{0} Dump {1} bytes per line", MsgId, Rest.DumpLineSize);
272 Rest.DumpLineSize);
273 } 278 }
274 279
275 // Load all of the handlers present in the 280 // Load all of the handlers present in the
@@ -361,11 +366,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
361 /// underlying handlers and looks for the best match. It returns 366 /// underlying handlers and looks for the best match. It returns
362 /// true if a match is found. 367 /// true if a match is found.
363 /// The matching process could be made arbitrarily complex. 368 /// The matching process could be made arbitrarily complex.
369 /// Note: The match is case-insensitive.
364 /// </summary> 370 /// </summary>
365 371
366 public bool Match(OSHttpRequest request, OSHttpResponse response) 372 public bool Match(OSHttpRequest request, OSHttpResponse response)
367 { 373 {
368 string path = request.RawUrl; 374
375 string path = request.RawUrl.ToLower();
369 376
370 Rest.Log.DebugFormat("{0} Match ENTRY", MsgId); 377 Rest.Log.DebugFormat("{0} Match ENTRY", MsgId);
371 378
@@ -483,6 +490,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
483 /// If there is a stream handler registered that can handle the 490 /// If there is a stream handler registered that can handle the
484 /// request, then fine. If the request is not matched, do 491 /// request, then fine. If the request is not matched, do
485 /// nothing. 492 /// nothing.
493 /// Note: The selection is case-insensitive
486 /// </summary> 494 /// </summary>
487 495
488 private bool FindStreamHandler(OSHttpRequest request, OSHttpResponse response) 496 private bool FindStreamHandler(OSHttpRequest request, OSHttpResponse response)
@@ -490,7 +498,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
490 RequestData rdata = new RequestData(request, response, String.Empty); 498 RequestData rdata = new RequestData(request, response, String.Empty);
491 499
492 string bestMatch = null; 500 string bestMatch = null;
493 string path = String.Format("{0}:{1}", rdata.method, rdata.path); 501 string path = String.Format("{0}:{1}", rdata.method, rdata.path).ToLower();
494 502
495 Rest.Log.DebugFormat("{0} Checking for stream handler for <{1}>", MsgId, path); 503 Rest.Log.DebugFormat("{0} Checking for stream handler for <{1}>", MsgId, path);
496 504
@@ -567,6 +575,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
567 /// handler was located. The boolean indicates whether or not the request has been 575 /// handler was located. The boolean indicates whether or not the request has been
568 /// handled, not whether or not the request was successful - that information is in 576 /// handled, not whether or not the request was successful - that information is in
569 /// the response. 577 /// the response.
578 /// Note: The selection process is case-insensitive
570 /// </summary> 579 /// </summary>
571 580
572 internal bool FindPathHandler(OSHttpRequest request, OSHttpResponse response) 581 internal bool FindPathHandler(OSHttpRequest request, OSHttpResponse response)
@@ -585,7 +594,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
585 594
586 foreach (string pattern in pathHandlers.Keys) 595 foreach (string pattern in pathHandlers.Keys)
587 { 596 {
588 if (request.RawUrl.StartsWith(pattern)) 597 if (request.RawUrl.ToLower().StartsWith(pattern))
589 { 598 {
590 if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length) 599 if (String.IsNullOrEmpty(bestMatch) || pattern.Length > bestMatch.Length)
591 { 600 {