aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs34
1 files changed, 19 insertions, 15 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
index a319a8b..b89976f 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
@@ -67,18 +67,18 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
67 try 67 try
68 { 68 {
69 // param empty: regions list 69 // param empty: regions list
70 if (String.IsNullOrEmpty(param)) return GetHandlerRegions(); 70 if (String.IsNullOrEmpty(param)) return GetHandlerRegions(httpResponse);
71 71
72 // param not empty: specific region 72 // param not empty: specific region
73 return GetHandlerRegion(param); 73 return GetHandlerRegion(httpResponse, param);
74 } 74 }
75 catch (Exception e) 75 catch (Exception e)
76 { 76 {
77 return Failure("GET", e); 77 return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "GET", e);
78 } 78 }
79 } 79 }
80 80
81 public string GetHandlerRegions() 81 public string GetHandlerRegions(OSHttpResponse httpResponse)
82 { 82 {
83 XmlWriter.WriteStartElement(String.Empty, "regions", String.Empty); 83 XmlWriter.WriteStartElement(String.Empty, "regions", String.Empty);
84 foreach (Scene s in App.SceneManager.Scenes) 84 foreach (Scene s in App.SceneManager.Scenes)
@@ -105,7 +105,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
105 return XmlWriterResult; 105 return XmlWriterResult;
106 } 106 }
107 107
108 public string GetHandlerRegion(string param) 108 public string GetHandlerRegion(OSHttpResponse httpResponse, string param)
109 { 109 {
110 // be resilient and don't get confused by a terminating '/' 110 // be resilient and don't get confused by a terminating '/'
111 param = param.TrimEnd(new char[]{'/'}); 111 param = param.TrimEnd(new char[]{'/'});
@@ -118,7 +118,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
118 118
119 Scene scene = null; 119 Scene scene = null;
120 App.SceneManager.TryGetScene(regionID, out scene); 120 App.SceneManager.TryGetScene(regionID, out scene);
121 if (null == scene) return Failure("GET", "cannot find region"); 121 if (null == scene) return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound,
122 "GET", "cannot find region {0}", regionID.ToString());
122 123
123 RegionDetails details = new RegionDetails(scene.RegionInfo); 124 RegionDetails details = new RegionDetails(scene.RegionInfo);
124 125
@@ -143,25 +144,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
143 switch (comps[1].ToLower()) 144 switch (comps[1].ToLower())
144 { 145 {
145 case "terrain": 146 case "terrain":
146 return RegionTerrain(scene); 147 return RegionTerrain(httpResponse, scene);
147 148
148 case "stats": 149 case "stats":
149 return RegionStats(scene); 150 return RegionStats(httpResponse, scene);
150 151
151 case "prims": 152 case "prims":
152 return RegionPrims(scene); 153 return RegionPrims(httpResponse, scene);
153 } 154 }
154 } 155 }
155 return Failure("GET", "too many parameters"); 156 return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
157 "GET", "too many parameters {0}", param);
156 } 158 }
157 #endregion GET methods 159 #endregion GET methods
158 160
159 protected string RegionTerrain(Scene scene) 161 protected string RegionTerrain(OSHttpResponse httpResponse, Scene scene)
160 { 162 {
161 return Failure("GET", "terrain not implemented"); 163 return Failure(httpResponse, OSHttpStatusCode.ServerErrorNotImplemented,
164 "GET", "terrain not implemented");
162 } 165 }
163 166
164 protected string RegionStats(Scene scene) 167 protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
165 { 168 {
166 int users = scene.GetAvatars().Count; 169 int users = scene.GetAvatars().Count;
167 int objects = scene.Entities.Count - users; 170 int objects = scene.Entities.Count - users;
@@ -182,9 +185,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
182 return XmlWriterResult; 185 return XmlWriterResult;
183 } 186 }
184 187
185 protected string RegionPrims(Scene scene) 188 protected string RegionPrims(OSHttpResponse httpResponse, Scene scene)
186 { 189 {
187 return Failure("GET", "prims not implemented"); 190 return Failure(httpResponse, OSHttpStatusCode.ServerErrorNotImplemented,
191 "GET", "prims not implemented");
188 } 192 }
189 } 193 }
190} 194}