* refactor: call AddStreamHandler() directly via CommsManager

0.6.2-post-fixes
Justin Clarke Casey 2009-01-06 14:37:39 +00:00
parent 579f11b3b8
commit b07c188b7e
3 changed files with 16 additions and 28 deletions

View File

@ -121,12 +121,12 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
{
IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin;
m_scene.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
m_scene.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
}
///// <summary>
///// Check that the source of an inventory request is one that we trust.
///// </summary>

View File

@ -30,12 +30,9 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
@ -93,11 +90,13 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
}
#endregion
}
public class InventoryService
{
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private InventoryServiceBase m_inventoryService;
private IUserService m_userService;
private bool m_doLookup = false;
@ -107,44 +106,43 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
get { return m_doLookup; }
set { m_doLookup = value; }
}
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public InventoryService(Scene m_scene)
{
m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
m_userService = m_scene.CommsManager.UserService;
AddHttpHandlers(m_scene);
}
protected void AddHttpHandlers(Scene m_scene)
{
m_scene.AddStreamHandler(
BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
"POST", "/GetInventory/", GetUserInventory, CheckAuthSession));
m_scene.AddStreamHandler(
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession));
m_scene.AddStreamHandler(
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession));
m_scene.AddStreamHandler(
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession));
m_scene.AddStreamHandler(
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
"POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession));
m_scene.AddStreamHandler(
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession));
m_scene.AddStreamHandler(
httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession));

View File

@ -4185,16 +4185,6 @@ namespace OpenSim.Region.Environment.Scenes
return m_httpListener.AddHTTPHandler(method, handler);
}
public void AddStreamHandler(IRequestHandler handler)
{
m_httpListener.AddStreamHandler(handler);
}
public void RemoveStreamHandler(string httpMethod, string path)
{
m_httpListener.RemoveStreamHandler(httpMethod, path);
}
public void RemoveHTTPHandler(string httpMethod, string path)
{
m_httpListener.RemoveHTTPHandler(httpMethod, path);