30 using System.Reflection;
34 using OpenSim.Server.Base;
35 using OpenSim.Server.Handlers.Base;
36 using OpenSim.Services.Interfaces;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Servers.HttpServer;
42 using OpenMetaverse.StructuredData;
47 namespace OpenSim.Server.Handlers.Neighbour
55 base(
"GET",
"/region")
65 Console.WriteLine(
"--- Get region --- " + path);
66 httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
67 return new byte[] { };
73 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
79 base(
"POST",
"/region")
81 m_NeighbourService = service;
82 m_AuthenticationService = authentication;
89 byte[] result =
new byte[0];
96 m_log.InfoFormat(
"[RegionPostHandler]: Invalid parameters for neighbour message {0}", path);
97 httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
98 httpResponse.
StatusDescription =
"Invalid parameters for neighbour message " + path;
103 if (m_AuthenticationService != null)
106 string authority = string.Empty;
107 string authToken = string.Empty;
110 m_log.InfoFormat(
"[RegionPostHandler]: Authentication failed for neighbour message {0}", path);
111 httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
121 m_log.DebugFormat(
"[RegionPostHandler]: Authentication succeeded for {0}", regionID);
127 httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
129 m_log.DebugFormat(
"[RegionPostHandler]: Unable to retrieve data for post {0}", path);
134 ulong regionhandle = 0;
135 if (args[
"destination_handle"] != null)
136 UInt64.TryParse(args[
"destination_handle"].AsString(), out regionhandle);
141 aRegion.UnpackRegionInfoData(args);
145 m_log.InfoFormat(
"[RegionPostHandler]: exception on unpacking region info {0}", ex.Message);
146 httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
152 GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion);
156 if (thisRegion != null)
157 resp[
"success"] = OSD.FromBoolean(
true);
159 resp[
"success"] = OSD.FromBoolean(
false);
161 httpResponse.StatusCode = (int)HttpStatusCode.OK;
163 return Util.UTF8.GetBytes(OSDParser.SerializeJsonString(resp));
173 base(
"PUT",
"/region")
183 httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
184 return new byte[] { };
194 base(
"DELETE",
"/region")
204 httpResponse.StatusCode = (int)HttpStatusCode.NotImplemented;
205 return new byte[] { };
NeighbourDeleteHandler(INeighbourService service, IAuthenticationService authentication)
override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
NeighbourPutHandler(INeighbourService service, IAuthenticationService authentication)
static bool GetParams(string path, out UUID uuid, out ulong regionHandle, out string action)
Extract the param from an uri.
OpenSim.Framework.RegionInfo RegionInfo
string StatusDescription
HTTP status description.
Base streamed request handler.
OpenMetaverse.StructuredData.OSDMap OSDMap
OpenSim.Services.Interfaces.GridRegion GridRegion
NeighbourPostHandler(INeighbourService service, IAuthenticationService authentication)
NeighbourGetHandler(INeighbourService service, IAuthenticationService authentication)
override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
Interactive OpenSim region server
override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
static bool GetAuthentication(IOSHttpRequest httpRequest, out string authority, out string authKey)