aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/Regions
diff options
context:
space:
mode:
authorDr Scofield2008-08-15 07:28:28 +0000
committerDr Scofield2008-08-15 07:28:28 +0000
commit9df18bb5444d1e3e6416f82d5fcf49b54b0c39d6 (patch)
tree8e59f42afcb1c0a7d3b1f719f104fe3b05847420 /OpenSim/ApplicationPlugins/Rest/Regions
parentFrom: Richard Alimi <ralimi@us.ibm.com> (diff)
downloadopensim-SC_OLD-9df18bb5444d1e3e6416f82d5fcf49b54b0c39d6.zip
opensim-SC_OLD-9df18bb5444d1e3e6416f82d5fcf49b54b0c39d6.tar.gz
opensim-SC_OLD-9df18bb5444d1e3e6416f82d5fcf49b54b0c39d6.tar.bz2
opensim-SC_OLD-9df18bb5444d1e3e6416f82d5fcf49b54b0c39d6.tar.xz
From: Richard Alimi <ralimi@us.ibm.com>
The following patch implements retrieving prims in Xml2 format via the REST interface. For example: http://localhost:9000/admin/regions/<region-uuid>/prims/ It also allows an additional parameter which specifies a bounding box. If this parameter is specified, only prims within the bounding box are retrieved. For example: http://localhost:9000/admin/regions/8cd759b4-e077-489d-9a34-e1ff70ef65dd/prims/0,0,0,128,128,128 will retrieve only the prims whose positions are in the bounding box with corners (0,0,0) and (128,128,128).
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Regions')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs39
1 files changed, 35 insertions, 4 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
index a605d09..e5ec94b 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
@@ -149,9 +149,38 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
149 return RegionStats(httpResponse, scene); 149 return RegionStats(httpResponse, scene);
150 150
151 case "prims": 151 case "prims":
152 return RegionPrims(httpResponse, scene); 152 return RegionPrims(httpResponse, scene, LLVector3.Zero, LLVector3.Zero);
153 } 153 }
154 } 154 }
155
156 if (3 == comps.Length) {
157 switch (comps[1].ToLower())
158 {
159 case "prims":
160 string[] subregion = comps[2].Split(',');
161 if (subregion.Length == 6)
162 {
163 LLVector3 min, max;
164 try
165 {
166 min = new LLVector3((float)Double.Parse(subregion[0]), (float)Double.Parse(subregion[1]), (float)Double.Parse(subregion[2]));
167 max = new LLVector3((float)Double.Parse(subregion[3]), (float)Double.Parse(subregion[4]), (float)Double.Parse(subregion[5]));
168 }
169 catch (Exception e)
170 {
171 return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
172 "GET", "invalid subregion parameter");
173 }
174 return RegionPrims(httpResponse, scene, min, max);
175 }
176 else
177 {
178 return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
179 "GET", "invalid subregion parameter");
180 }
181 }
182 }
183
155 return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest, 184 return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
156 "GET", "too many parameters {0}", param); 185 "GET", "too many parameters {0}", param);
157 } 186 }
@@ -184,10 +213,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
184 return XmlWriterResult; 213 return XmlWriterResult;
185 } 214 }
186 215
187 protected string RegionPrims(OSHttpResponse httpResponse, Scene scene) 216 protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, LLVector3 min, LLVector3 max)
188 { 217 {
189 return Failure(httpResponse, OSHttpStatusCode.ServerErrorNotImplemented, 218 httpResponse.SendChunked = true;
190 "GET", "prims not implemented"); 219 httpResponse.ContentType = "text/xml";
220 scene.SavePrimsToXml2(new StreamWriter(httpResponse.OutputStream), min, max);
221 return "";
191 } 222 }
192 } 223 }
193} 224}