31 using System.Reflection;
32 using System.Threading;
37 using OpenSim.Server.Base;
38 using OpenSim.Services.Interfaces;
39 using OpenSim.Framework.Servers.HttpServer;
40 using OpenSim.Server.Handlers.Base;
43 namespace OpenSim.Server.Handlers.MapImage
51 private string m_ConfigName =
"MapImageService";
54 base(config, server, configName)
56 IConfig serverConfig = config.Configs[m_ConfigName];
57 if (serverConfig == null)
58 throw new Exception(String.Format(
"No section {0} in config file", m_ConfigName));
60 string gridService = serverConfig.GetString(
"LocalServiceModule",
63 if (gridService == String.Empty)
64 throw new Exception(
"No LocalServiceModule in config file");
66 Object[] args =
new Object[] { config };
75 public static ManualResetEvent ev =
new ManualResetEvent(
true);
84 m_MapService = service;
95 byte[] result =
new byte[0];
96 string format = string.Empty;
99 UUID scopeID = UUID.Zero;
101 string[] bits = path.Trim(
'/').Split(
new char[] {
'/'});
104 scopeID =
new UUID(bits[0]);
107 result = m_MapService.GetMapTile(path.Trim(
'/'), scopeID, out format);
108 if (result.Length > 0)
110 httpResponse.StatusCode = (int)HttpStatusCode.OK;
111 if (format.Equals(
".png"))
113 else if (format.Equals(
".jpg") || format.Equals(
".jpeg"))
114 httpResponse.ContentType =
"image/jpeg";
118 httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
string ContentType
Content type property.
Base streamed request handler.
Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) for given URLs.
MapServerGetHandler(IMapImageService service)
override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
MapGetServiceConnector(IConfigSource config, IHttpServer server, string configName)