aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Servers/BaseHttpServer.cs
diff options
context:
space:
mode:
authorlbsa712007-03-29 19:22:01 +0000
committerlbsa712007-03-29 19:22:01 +0000
commit30c5be370489f9620e0f199526c80f5c34f16faa (patch)
treec56a7ec877a9f5f935b25c3c4703b6d8bfcde662 /Servers/BaseHttpServer.cs
parent* RestMethod now uses same pattern as XmlRpcMethod (diff)
downloadopensim-SC_OLD-30c5be370489f9620e0f199526c80f5c34f16faa.zip
opensim-SC_OLD-30c5be370489f9620e0f199526c80f5c34f16faa.tar.gz
opensim-SC_OLD-30c5be370489f9620e0f199526c80f5c34f16faa.tar.bz2
opensim-SC_OLD-30c5be370489f9620e0f199526c80f5c34f16faa.tar.xz
* Now the rest handlers try to match path as close as possibly, so it's possible to add handlers for just a beginning of a path.
Diffstat (limited to '')
-rw-r--r--Servers/BaseHttpServer.cs20
1 files changed, 16 insertions, 4 deletions
diff --git a/Servers/BaseHttpServer.cs b/Servers/BaseHttpServer.cs
index 7c2a195..174402a 100644
--- a/Servers/BaseHttpServer.cs
+++ b/Servers/BaseHttpServer.cs
@@ -76,11 +76,23 @@ namespace OpenSim.Servers
76 string response; 76 string response;
77 RestMethod handler; 77 RestMethod handler;
78 78
79 string methodKey = String.Format("{0}: {1}", method, path); 79 string requestKey = String.Format("{0}: {1}", method, path);
80 80
81 if (m_restHandlers.TryGetValue(methodKey, out handler)) 81 string bestMatch = String.Empty;
82 foreach( string currentKey in m_restHandlers.Keys )
83 {
84 if( requestKey.StartsWith( currentKey ))
85 {
86 if(currentKey.Length > bestMatch.Length )
87 {
88 bestMatch = currentKey;
89 }
90 }
91 }
92
93 if (m_restHandlers.TryGetValue(bestMatch, out handler))
82 { 94 {
83 response = handler(request); 95 response = handler(request, path);
84 96
85 } 97 }
86 else 98 else