12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using Nini.Config;
- using OpenSim.Server.Base;
- using OpenSim.Services.Interfaces;
- using OpenSim.Framework.Servers.HttpServer;
- using OpenSim.Server.Handlers.Base;
- using OpenMetaverse;
- namespace OpenSim.Capabilities.Handlers
- {
- public class GetTextureServerConnector : ServiceConnector
- {
- private IAssetService m_AssetService;
- private string m_ConfigName = "CapsService";
- public GetTextureServerConnector(IConfigSource config, IHttpServer server, string configName) :
- base(config, server, configName)
- {
- if (configName != String.Empty)
- m_ConfigName = configName;
- IConfig serverConfig = config.Configs[m_ConfigName];
- if (serverConfig == null)
- throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
- string assetService = serverConfig.GetString("AssetService", String.Empty);
- if (assetService == String.Empty)
- throw new Exception("No AssetService in config file");
- Object[] args = new Object[] { config };
- m_AssetService =
- ServerUtils.LoadPlugin<IAssetService>(assetService, args);
- if (m_AssetService == null)
- throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
- string rurl = serverConfig.GetString("GetTextureRedirectURL");
- ;
- server.AddStreamHandler(
- new GetTextureRobustHandler("/CAPS/GetTexture/", m_AssetService, "GetTexture", null, rurl));
- }
- }
- }
|