* refactor: call AddStreamHandler() directly via CommsManager
parent
579f11b3b8
commit
b07c188b7e
|
@ -121,12 +121,12 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
|
||||||
{
|
{
|
||||||
IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin;
|
IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin;
|
||||||
|
|
||||||
m_scene.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
|
BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
|
||||||
m_scene.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
|
httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
|
||||||
|
httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///// <summary>
|
///// <summary>
|
||||||
///// Check that the source of an inventory request is one that we trust.
|
///// Check that the source of an inventory request is one that we trust.
|
||||||
///// </summary>
|
///// </summary>
|
||||||
|
|
|
@ -30,12 +30,9 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
@ -93,11 +90,13 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InventoryService
|
public class InventoryService
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log
|
||||||
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private InventoryServiceBase m_inventoryService;
|
private InventoryServiceBase m_inventoryService;
|
||||||
private IUserService m_userService;
|
private IUserService m_userService;
|
||||||
private bool m_doLookup = false;
|
private bool m_doLookup = false;
|
||||||
|
@ -107,44 +106,43 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
|
||||||
get { return m_doLookup; }
|
get { return m_doLookup; }
|
||||||
set { m_doLookup = value; }
|
set { m_doLookup = value; }
|
||||||
}
|
}
|
||||||
private static readonly ILog m_log
|
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
public InventoryService(Scene m_scene)
|
public InventoryService(Scene m_scene)
|
||||||
{
|
{
|
||||||
m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
|
m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
|
||||||
m_userService = m_scene.CommsManager.UserService;
|
m_userService = m_scene.CommsManager.UserService;
|
||||||
AddHttpHandlers(m_scene);
|
AddHttpHandlers(m_scene);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddHttpHandlers(Scene m_scene)
|
protected void AddHttpHandlers(Scene m_scene)
|
||||||
{
|
{
|
||||||
m_scene.AddStreamHandler(
|
BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
|
||||||
|
|
||||||
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||||
"POST", "/GetInventory/", GetUserInventory, CheckAuthSession));
|
"POST", "/GetInventory/", GetUserInventory, CheckAuthSession));
|
||||||
|
|
||||||
m_scene.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession));
|
"POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession));
|
||||||
|
|
||||||
m_scene.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession));
|
"POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession));
|
||||||
|
|
||||||
m_scene.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession));
|
"POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession));
|
||||||
|
|
||||||
m_scene.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||||
"POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession));
|
"POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession));
|
||||||
|
|
||||||
m_scene.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||||
"POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession));
|
"POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession));
|
||||||
|
|
||||||
m_scene.AddStreamHandler(
|
httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||||
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession));
|
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession));
|
||||||
|
|
||||||
|
|
|
@ -4185,16 +4185,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return m_httpListener.AddHTTPHandler(method, handler);
|
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)
|
public void RemoveHTTPHandler(string httpMethod, string path)
|
||||||
{
|
{
|
||||||
m_httpListener.RemoveHTTPHandler(httpMethod, path);
|
m_httpListener.RemoveHTTPHandler(httpMethod, path);
|
||||||
|
|
Loading…
Reference in New Issue