aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs65
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs63
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs73
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs57
-rw-r--r--OpenSim/ApplicationPlugins/Rest/RestPlugin.cs81
5 files changed, 167 insertions, 172 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
index b89976f..81eb5bd 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
@@ -1,30 +1,29 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4 *
5* Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15* 15 *
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26 */
27*/
28 27
29using System; 28using System;
30using System.Threading; 29using System.Threading;
@@ -54,10 +53,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
54 public partial class RestRegionPlugin : RestPlugin 53 public partial class RestRegionPlugin : RestPlugin
55 { 54 {
56 #region GET methods 55 #region GET methods
57 public string GetHandler(string request, string path, string param, 56 public string GetHandler(string request, string path, string param,
58 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 57 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
59 { 58 {
60 // foreach (string h in httpRequest.Headers.AllKeys) 59 // foreach (string h in httpRequest.Headers.AllKeys)
61 // foreach (string v in httpRequest.Headers.GetValues(h)) 60 // foreach (string v in httpRequest.Headers.GetValues(h))
62 // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v); 61 // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v);
63 62
@@ -72,7 +71,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
72 // param not empty: specific region 71 // param not empty: specific region
73 return GetHandlerRegion(httpResponse, param); 72 return GetHandlerRegion(httpResponse, param);
74 } 73 }
75 catch (Exception e) 74 catch (Exception e)
76 { 75 {
77 return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "GET", e); 76 return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "GET", e);
78 } 77 }
@@ -88,7 +87,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
88 XmlWriter.WriteEndElement(); 87 XmlWriter.WriteEndElement();
89 } 88 }
90 XmlWriter.WriteEndElement(); 89 XmlWriter.WriteEndElement();
91 90
92 return XmlWriterResult; 91 return XmlWriterResult;
93 } 92 }
94 93
@@ -141,7 +140,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
141 // m_log.DebugFormat("{0} GET comps advanced: >{1}<", MsgID, comps[1]); 140 // m_log.DebugFormat("{0} GET comps advanced: >{1}<", MsgID, comps[1]);
142 141
143 // check for {terrain,stats,prims} 142 // check for {terrain,stats,prims}
144 switch (comps[1].ToLower()) 143 switch (comps[1].ToLower())
145 { 144 {
146 case "terrain": 145 case "terrain":
147 return RegionTerrain(httpResponse, scene); 146 return RegionTerrain(httpResponse, scene);
@@ -175,13 +174,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
175 XmlWriter.WriteStartElement(String.Empty, "users", String.Empty); 174 XmlWriter.WriteStartElement(String.Empty, "users", String.Empty);
176 XmlWriter.WriteString(users.ToString()); 175 XmlWriter.WriteString(users.ToString());
177 XmlWriter.WriteEndElement(); 176 XmlWriter.WriteEndElement();
178 177
179 XmlWriter.WriteStartElement(String.Empty, "objects", String.Empty); 178 XmlWriter.WriteStartElement(String.Empty, "objects", String.Empty);
180 XmlWriter.WriteString(objects.ToString()); 179 XmlWriter.WriteString(objects.ToString());
181 XmlWriter.WriteEndElement(); 180 XmlWriter.WriteEndElement();
182 181
183 XmlWriter.WriteEndDocument(); 182 XmlWriter.WriteEndDocument();
184 183
185 return XmlWriterResult; 184 return XmlWriterResult;
186 } 185 }
187 186
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs
index 00fe0d2..e6131f1 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs
@@ -1,30 +1,29 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4 *
5* Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15* 15 *
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26 */
27*/
28 27
29using System; 28using System;
30using System.Threading; 29using System.Threading;
@@ -54,10 +53,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
54 public partial class RestRegionPlugin : RestPlugin 53 public partial class RestRegionPlugin : RestPlugin
55 { 54 {
56 #region POST methods 55 #region POST methods
57 public string PostHandler(string request, string path, string param, 56 public string PostHandler(string request, string path, string param,
58 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 57 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
59 { 58 {
60 // foreach (string h in httpRequest.Headers.AllKeys) 59 // foreach (string h in httpRequest.Headers.AllKeys)
61 // foreach (string v in httpRequest.Headers.GetValues(h)) 60 // foreach (string v in httpRequest.Headers.GetValues(h))
62 // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v); 61 // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v);
63 62
@@ -67,17 +66,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
67 try 66 try
68 { 67 {
69 // param empty: new region post 68 // param empty: new region post
70 if (!IsGod(httpRequest)) 69 if (!IsGod(httpRequest))
71 // XXX: this needs to be turned into a FailureUnauthorized(...) 70 // XXX: this needs to be turned into a FailureUnauthorized(...)
72 return Failure(httpResponse, OSHttpStatusCode.ClientErrorUnauthorized, 71 return Failure(httpResponse, OSHttpStatusCode.ClientErrorUnauthorized,
73 "GET", "you are not god"); 72 "GET", "you are not god");
74 73
75 if (String.IsNullOrEmpty(param)) return CreateRegion(httpRequest, httpResponse); 74 if (String.IsNullOrEmpty(param)) return CreateRegion(httpRequest, httpResponse);
76 75
77 return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound, 76 return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound,
78 "POST", "url {0} not supported", param); 77 "POST", "url {0} not supported", param);
79 } 78 }
80 catch (Exception e) 79 catch (Exception e)
81 { 80 {
82 return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "POST", e); 81 return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "POST", e);
83 } 82 }
@@ -93,7 +92,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
93 XmlWriter.WriteEndElement(); 92 XmlWriter.WriteEndElement();
94 } 93 }
95 XmlWriter.WriteEndElement(); 94 XmlWriter.WriteEndElement();
96 95
97 return XmlWriterResult; 96 return XmlWriterResult;
98 } 97 }
99 #endregion POST methods 98 #endregion POST methods
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs b/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
index c86c67f..5de623c 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
@@ -1,30 +1,29 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4 *
5* Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15* 15 *
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26 */
27*/
28 27
29using libsecondlife; 28using libsecondlife;
30using System; 29using System;
@@ -65,35 +64,35 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
65 region_external_hostname = regInfo.ExternalHostName; 64 region_external_hostname = regInfo.ExternalHostName;
66 65
67 if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName)) 66 if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName))
68 region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName, 67 region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName,
69 regInfo.MasterAvatarLastName); 68 regInfo.MasterAvatarLastName);
70 } 69 }
71 70
72 public string this[string idx] 71 public string this[string idx]
73 { 72 {
74 get 73 get
75 { 74 {
76 switch(idx.ToLower()) 75 switch(idx.ToLower())
77 { 76 {
78 case "name": 77 case "name":
79 return region_name; 78 return region_name;
80 case "id": 79 case "id":
81 return region_id; 80 return region_id;
82 case "location": 81 case "location":
83 return String.Format("<x>{0}</x><y>{1}</y>", region_x, region_y); 82 return String.Format("<x>{0}</x><y>{1}</y>", region_x, region_y);
84 case "owner": 83 case "owner":
85 return region_owner; 84 return region_owner;
86 case "owner_id": 85 case "owner_id":
87 return region_owner_id; 86 return region_owner_id;
88 case "http_port": 87 case "http_port":
89 return region_http_port.ToString(); 88 return region_http_port.ToString();
90 case "server_uri": 89 case "server_uri":
91 return region_server_uri; 90 return region_server_uri;
92 case "external_hostname": 91 case "external_hostname":
93 case "hostname": 92 case "hostname":
94 return region_external_hostname; 93 return region_external_hostname;
95 94
96 default: 95 default:
97 return null; 96 return null;
98 } 97 }
99 } 98 }
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs b/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
index 6d585a4..24bed99 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
@@ -1,30 +1,29 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4 *
5* Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15* 15 *
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26 */
27*/
28 27
29using System; 28using System;
30using System.Threading; 29using System.Threading;
@@ -58,8 +57,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
58 public partial class RestRegionPlugin : RestPlugin 57 public partial class RestRegionPlugin : RestPlugin
59 { 58 {
60 #region overriding properties 59 #region overriding properties
61 public override string Name 60 public override string Name
62 { 61 {
63 get { return "REGION"; } 62 get { return "REGION"; }
64 } 63 }
65 64
@@ -83,7 +82,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
83 try 82 try
84 { 83 {
85 base.Initialise(openSim); 84 base.Initialise(openSim);
86 if (!IsEnabled) 85 if (!IsEnabled)
87 { 86 {
88 m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID); 87 m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
89 return; 88 return;
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index f1ca83d..c502e28 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -1,30 +1,29 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4 *
5* Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15* 15 *
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26 */
27*/
28 27
29using System; 28using System;
30using System.Threading; 29using System.Threading;
@@ -56,7 +55,7 @@ namespace OpenSim.ApplicationPlugins.Rest
56 { 55 {
57 #region properties 56 #region properties
58 57
59 protected static readonly log4net.ILog m_log = 58 protected static readonly log4net.ILog m_log =
60 log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 60
62 private IConfig _config; // Configuration source: Rest Plugins 61 private IConfig _config; // Configuration source: Rest Plugins
@@ -106,8 +105,8 @@ namespace OpenSim.ApplicationPlugins.Rest
106 /// </summary> 105 /// </summary>
107 public bool IsEnabled 106 public bool IsEnabled
108 { 107 {
109 get 108 get
110 { 109 {
111 return (null != _pluginConfig) && _pluginConfig.GetBoolean("enabled", false); 110 return (null != _pluginConfig) && _pluginConfig.GetBoolean("enabled", false);
112 } 111 }
113 } 112 }
@@ -115,7 +114,7 @@ namespace OpenSim.ApplicationPlugins.Rest
115 /// <summary> 114 /// <summary>
116 /// OpenSimMain application 115 /// OpenSimMain application
117 /// </summary> 116 /// </summary>
118 public OpenSimMain App 117 public OpenSimMain App
119 { 118 {
120 get { return _app; } 119 get { return _app; }
121 } 120 }
@@ -123,7 +122,7 @@ namespace OpenSim.ApplicationPlugins.Rest
123 /// <summary> 122 /// <summary>
124 /// RPC server 123 /// RPC server
125 /// </summary> 124 /// </summary>
126 public BaseHttpServer HttpServer 125 public BaseHttpServer HttpServer
127 { 126 {
128 get { return _httpd; } 127 get { return _httpd; }
129 } 128 }
@@ -156,7 +155,7 @@ namespace OpenSim.ApplicationPlugins.Rest
156 155
157 public XmlTextWriter XmlWriter 156 public XmlTextWriter XmlWriter
158 { 157 {
159 get { 158 get {
160 if (null == _xw) 159 if (null == _xw)
161 { 160 {
162 _sw = new StringWriter(); 161 _sw = new StringWriter();
@@ -200,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.Rest
200 return; 199 return;
201 } 200 }
202 201
203 if (!_config.GetBoolean("enabled", false)) 202 if (!_config.GetBoolean("enabled", false))
204 { 203 {
205 m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID); 204 m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
206 return; 205 return;
@@ -211,14 +210,14 @@ namespace OpenSim.ApplicationPlugins.Rest
211 210
212 // Retrieve GOD key value, if any. 211 // Retrieve GOD key value, if any.
213 _godkey = _config.GetString("god_key", String.Empty); 212 _godkey = _config.GetString("god_key", String.Empty);
214 213
215 // Retrive prefix if any. 214 // Retrive prefix if any.
216 _prefix = _config.GetString("prefix", "/admin"); 215 _prefix = _config.GetString("prefix", "/admin");
217 216
218 // Get plugin specific config 217 // Get plugin specific config
219 _pluginConfig = openSim.ConfigSource.Configs[ConfigName]; 218 _pluginConfig = openSim.ConfigSource.Configs[ConfigName];
220 219
221 220
222 m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID); 221 m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);
223 } 222 }
224 catch (Exception e) 223 catch (Exception e)
@@ -231,7 +230,7 @@ namespace OpenSim.ApplicationPlugins.Rest
231 // not possible for the openSim pointer to be null. However 230 // not possible for the openSim pointer to be null. However
232 // were the implementation to be changed, this could 231 // were the implementation to be changed, this could
233 // result in a silent initialization failure. Harmless 232 // result in a silent initialization failure. Harmless
234 // except for lack of function and lack of any 233 // except for lack of function and lack of any
235 // diagnostic indication as to why. The same is true if 234 // diagnostic indication as to why. The same is true if
236 // the HTTP server reference is bad. 235 // the HTTP server reference is bad.
237 // We should at least issue a message... 236 // We should at least issue a message...
@@ -254,7 +253,7 @@ namespace OpenSim.ApplicationPlugins.Rest
254 { 253 {
255 if (!IsEnabled) return; 254 if (!IsEnabled) return;
256 255
257 if (!path.StartsWith(_prefix)) 256 if (!path.StartsWith(_prefix))
258 { 257 {
259 path = String.Format("{0}{1}", _prefix, path); 258 path = String.Format("{0}{1}", _prefix, path);
260 } 259 }
@@ -354,7 +353,7 @@ namespace OpenSim.ApplicationPlugins.Rest
354 /// <param name="method">origin of the failure message</param> 353 /// <param name="method">origin of the failure message</param>
355 /// <param name="message">failure message</param> 354 /// <param name="message">failure message</param>
356 /// <remarks>This should probably set a return code as 355 /// <remarks>This should probably set a return code as
357 /// well. (?)</remarks> 356 /// well. (?)</remarks>
358 protected string Failure(OSHttpResponse response, OSHttpStatusCode status, 357 protected string Failure(OSHttpResponse response, OSHttpStatusCode status,
359 string method, string format, params string[] msg) 358 string method, string format, params string[] msg)
360 { 359 {
@@ -373,8 +372,8 @@ namespace OpenSim.ApplicationPlugins.Rest
373 /// <param name="method">origin of the failure message</param> 372 /// <param name="method">origin of the failure message</param>
374 /// <param name="e">exception causing the failure message</param> 373 /// <param name="e">exception causing the failure message</param>
375 /// <remarks>This should probably set a return code as 374 /// <remarks>This should probably set a return code as
376 /// well. (?)</remarks> 375 /// well. (?)</remarks>
377 public string Failure(OSHttpResponse response, OSHttpStatusCode status, 376 public string Failure(OSHttpResponse response, OSHttpStatusCode status,
378 string method, Exception e) 377 string method, Exception e)
379 { 378 {
380 string m = String.Format("exception occurred: {0}", e.Message); 379 string m = String.Format("exception occurred: {0}", e.Message);