aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-06 14:37:39 +0000
committerJustin Clarke Casey2009-01-06 14:37:39 +0000
commitb07c188b7e4793c50e1169b0b3c2e08cce33664f (patch)
treebf4ccce3277f3f353b89856eecc5c06e16586568 /OpenSim
parent* refactor: call AddLLSDHandler directly via CommsManager (diff)
downloadopensim-SC-b07c188b7e4793c50e1169b0b3c2e08cce33664f.zip
opensim-SC-b07c188b7e4793c50e1169b0b3c2e08cce33664f.tar.gz
opensim-SC-b07c188b7e4793c50e1169b0b3c2e08cce33664f.tar.bz2
opensim-SC-b07c188b7e4793c50e1169b0b3c2e08cce33664f.tar.xz
* refactor: call AddStreamHandler() directly via CommsManager
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs8
-rw-r--r--OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs26
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
3 files changed, 16 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs
index d090052..a5b45ea 100644
--- a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs
+++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs
@@ -120,13 +120,13 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
120 protected void AddHttpHandlers(Scene m_scene) 120 protected void AddHttpHandlers(Scene m_scene)
121 { 121 {
122 IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin; 122 IAssetProviderPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin;
123 123
124 m_scene.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); 124 BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
125 m_scene.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); 125 httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
126 httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
126 127
127 } 128 }
128 129
129
130 ///// <summary> 130 ///// <summary>
131 ///// Check that the source of an inventory request is one that we trust. 131 ///// Check that the source of an inventory request is one that we trust.
132 ///// </summary> 132 ///// </summary>
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs
index bfdbcfc..b10582b 100644
--- a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs
+++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs
@@ -30,12 +30,9 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33
34using log4net; 33using log4net;
35using Nini.Config; 34using Nini.Config;
36
37using OpenMetaverse; 35using OpenMetaverse;
38
39using OpenSim.Framework; 36using OpenSim.Framework;
40using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Cache; 38using OpenSim.Framework.Communications.Cache;
@@ -93,11 +90,13 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
93 } 90 }
94 91
95 #endregion 92 #endregion
96
97 } 93 }
98 94
99 public class InventoryService 95 public class InventoryService
100 { 96 {
97 private static readonly ILog m_log
98 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
99
101 private InventoryServiceBase m_inventoryService; 100 private InventoryServiceBase m_inventoryService;
102 private IUserService m_userService; 101 private IUserService m_userService;
103 private bool m_doLookup = false; 102 private bool m_doLookup = false;
@@ -107,44 +106,43 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid
107 get { return m_doLookup; } 106 get { return m_doLookup; }
108 set { m_doLookup = value; } 107 set { m_doLookup = value; }
109 } 108 }
110 private static readonly ILog m_log
111 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
112 109
113 public InventoryService(Scene m_scene) 110 public InventoryService(Scene m_scene)
114 { 111 {
115 m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; 112 m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
116 m_userService = m_scene.CommsManager.UserService; 113 m_userService = m_scene.CommsManager.UserService;
117 AddHttpHandlers(m_scene); 114 AddHttpHandlers(m_scene);
118
119 } 115 }
120 116
121 protected void AddHttpHandlers(Scene m_scene) 117 protected void AddHttpHandlers(Scene m_scene)
122 { 118 {
123 m_scene.AddStreamHandler( 119 BaseHttpServer httpServer = m_scene.CommsManager.HttpServer;
120
121 httpServer.AddStreamHandler(
124 new RestDeserialiseSecureHandler<Guid, InventoryCollection>( 122 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
125 "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); 123 "POST", "/GetInventory/", GetUserInventory, CheckAuthSession));
126 124
127 m_scene.AddStreamHandler( 125 httpServer.AddStreamHandler(
128 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 126 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
129 "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession)); 127 "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession));
130 128
131 m_scene.AddStreamHandler( 129 httpServer.AddStreamHandler(
132 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 130 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
133 "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession)); 131 "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession));
134 132
135 m_scene.AddStreamHandler( 133 httpServer.AddStreamHandler(
136 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 134 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
137 "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession)); 135 "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession));
138 136
139 m_scene.AddStreamHandler( 137 httpServer.AddStreamHandler(
140 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( 138 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
141 "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession)); 139 "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession));
142 140
143 m_scene.AddStreamHandler( 141 httpServer.AddStreamHandler(
144 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 142 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
145 "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession)); 143 "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession));
146 144
147 m_scene.AddStreamHandler( 145 httpServer.AddStreamHandler(
148 new RestDeserialiseSecureHandler<InventoryItemBase, bool>( 146 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
149 "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession)); 147 "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession));
150 148
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index ac1461e..d6b3f0e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -4185,16 +4185,6 @@ namespace OpenSim.Region.Environment.Scenes
4185 return m_httpListener.AddHTTPHandler(method, handler); 4185 return m_httpListener.AddHTTPHandler(method, handler);
4186 } 4186 }
4187 4187
4188 public void AddStreamHandler(IRequestHandler handler)
4189 {
4190 m_httpListener.AddStreamHandler(handler);
4191 }
4192
4193 public void RemoveStreamHandler(string httpMethod, string path)
4194 {
4195 m_httpListener.RemoveStreamHandler(httpMethod, path);
4196 }
4197
4198 public void RemoveHTTPHandler(string httpMethod, string path) 4188 public void RemoveHTTPHandler(string httpMethod, string path)
4199 { 4189 {
4200 m_httpListener.RemoveHTTPHandler(httpMethod, path); 4190 m_httpListener.RemoveHTTPHandler(httpMethod, path);