diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs index aa93f28..c689daa 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs | |||
@@ -34,10 +34,10 @@ using OpenSim.Region.Framework.Scenes; | |||
34 | 34 | ||
35 | namespace OpenSim.ApplicationPlugins.Rest.Regions | 35 | namespace OpenSim.ApplicationPlugins.Rest.Regions |
36 | { | 36 | { |
37 | |||
38 | public partial class RestRegionPlugin : RestPlugin | 37 | public partial class RestRegionPlugin : RestPlugin |
39 | { | 38 | { |
40 | #region POST methods | 39 | #region POST methods |
40 | |||
41 | public string PostHandler(string request, string path, string param, | 41 | public string PostHandler(string request, string path, string param, |
42 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 42 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
43 | { | 43 | { |
@@ -59,24 +59,26 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
59 | if (String.IsNullOrEmpty(param)) return CreateRegion(httpRequest, httpResponse); | 59 | if (String.IsNullOrEmpty(param)) return CreateRegion(httpRequest, httpResponse); |
60 | 60 | ||
61 | // Parse region ID and other parameters | 61 | // Parse region ID and other parameters |
62 | param = param.TrimEnd(new char[]{'/'}); | 62 | param = param.TrimEnd(new char[] {'/'}); |
63 | string[] comps = param.Split('/'); | 63 | string[] comps = param.Split('/'); |
64 | UUID regionID = (UUID)comps[0]; | 64 | UUID regionID = (UUID) comps[0]; |
65 | 65 | ||
66 | m_log.DebugFormat("{0} POST region UUID {1}", MsgID, regionID.ToString()); | 66 | m_log.DebugFormat("{0} POST region UUID {1}", MsgID, regionID.ToString()); |
67 | if (UUID.Zero == regionID) throw new Exception("missing region ID"); | 67 | if (UUID.Zero == regionID) throw new Exception("missing region ID"); |
68 | 68 | ||
69 | Scene scene = null; | 69 | Scene scene = null; |
70 | App.SceneManager.TryGetScene(regionID, out scene); | 70 | App.SceneManager.TryGetScene(regionID, out scene); |
71 | if (null == scene) return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound, | 71 | if (null == scene) |
72 | "POST", "cannot find region {0}", regionID.ToString()); | 72 | return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound, |
73 | "POST", "cannot find region {0}", regionID.ToString()); | ||
73 | 74 | ||
74 | if (2 == comps.Length) { | 75 | if (2 == comps.Length) |
76 | { | ||
75 | // check for {prims} | 77 | // check for {prims} |
76 | switch (comps[1].ToLower()) | 78 | switch (comps[1].ToLower()) |
77 | { | 79 | { |
78 | case "prims": | 80 | case "prims": |
79 | return LoadPrims(request, httpRequest, httpResponse, scene); | 81 | return LoadPrims(request, httpRequest, httpResponse, scene); |
80 | } | 82 | } |
81 | } | 83 | } |
82 | 84 | ||
@@ -106,12 +108,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
106 | public string LoadPrims(string requestBody, OSHttpRequest request, OSHttpResponse response, Scene scene) | 108 | public string LoadPrims(string requestBody, OSHttpRequest request, OSHttpResponse response, Scene scene) |
107 | { | 109 | { |
108 | IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); | 110 | IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); |
109 | if (serialiser != null) | 111 | if (serialiser != null) |
110 | serialiser.LoadPrimsFromXml2(scene, new StringReader(requestBody), true); | 112 | serialiser.LoadPrimsFromXml2(scene, new StringReader(requestBody), true); |
111 | 113 | ||
112 | return ""; | 114 | return ""; |
113 | } | 115 | } |
114 | 116 | ||
115 | #endregion POST methods | 117 | #endregion POST methods |
116 | } | 118 | } |
117 | } | 119 | } \ No newline at end of file |