本文整理汇总了C#中IHttpServer.AddStreamHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpServer.AddStreamHandler方法的具体用法?C# IHttpServer.AddStreamHandler怎么用?C# IHttpServer.AddStreamHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpServer
的用法示例。
在下文中一共展示了IHttpServer.AddStreamHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssetServerConnector
public AssetServerConnector(IConfigSource config, IHttpServer server) :
base(config, server, "AssetService")
{
IConfig serverConfig = config.Configs["AssetService"];
if (serverConfig == null)
throw new Exception("No AssetService section in config file");
string assetService = serverConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(assetService))
throw new Exception("No LocalServiceModule in AssetService section in config file");
Object[] args = new Object[] { config };
m_AssetService = ServerUtils.LoadPlugin<IAssetService>(assetService, args);
if (m_AssetService == null)
throw new Exception("Failed to load IAssetService \"" + assetService + "\"");
// Asset service endpoints
server.AddStreamHandler(new TrustedStreamHandler("GET", "/assets", new CBAssetServerGetHandler(m_AssetService)));
server.AddStreamHandler(new TrustedStreamHandler("POST", "/assets", new CBAssetServerPostHandler(m_AssetService)));
server.AddStreamHandler(new TrustedStreamHandler("DELETE", "/assets", new CBAssetServerDeleteHandler(m_AssetService)));
// Register this server connector as a Cable Beach service
CableBeachServerState.RegisterService(new Uri(CableBeachServices.ASSETS), CreateCapabilitiesHandler);
CableBeachServerState.Log.Info("[CABLE BEACH ASSETS]: AssetServerConnector is running");
}
示例2: OpenIdServerConnector
public OpenIdServerConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
string authService = serverConfig.GetString("AuthenticationServiceModule",
String.Empty);
string userService = serverConfig.GetString("UserAccountServiceModule",
String.Empty);
if (authService == String.Empty || userService == String.Empty)
throw new Exception("No AuthenticationServiceModule or no UserAccountServiceModule in config file for OpenId authentication");
Object[] args = new Object[] { config };
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userService, args);
// Handler for OpenID user identity pages
server.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", m_UserAccountService, m_AuthenticationService));
// Handlers for the OpenID endpoint server
server.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server/", m_UserAccountService, m_AuthenticationService));
server.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server/", m_UserAccountService, m_AuthenticationService));
m_log.Info("[OPENID]: OpenId service enabled");
}
示例3: GetMeshServerConnector
public GetMeshServerConnector(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("GetMeshRedirectURL");
server.AddStreamHandler(
new GetTextureHandler("/CAPS/GetMesh/" /*+ UUID.Random() */, m_AssetService, "GetMesh", null, rurl));
rurl = serverConfig.GetString("GetMesh2RedirectURL");
server.AddStreamHandler(
new GetTextureHandler("/CAPS/GetMesh2/" /*+ UUID.Random() */, m_AssetService, "GetMesh2", null, rurl));
}
示例4: XBakesConnector
public XBakesConnector(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("LocalServiceModule",
String.Empty);
if (assetService == String.Empty)
throw new Exception("No BakedTextureService in config file");
Object[] args = new Object[] { config };
m_BakesService =
ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args);
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth));
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth));
}
示例5: EventManager_OnRegisterCaps
private OSDMap EventManager_OnRegisterCaps(UUID agentID, IHttpServer server)
{
OSDMap retVal = new OSDMap();
retVal["EnvironmentSettings"] = CapsUtil.CreateCAPS("EnvironmentSettings", "");
#if (!ISWIN)
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
delegate(Hashtable m_dhttpMethod)
{
return SetEnvironment(m_dhttpMethod, agentID);
}));
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
delegate(Hashtable m_dhttpMethod)
{
return EnvironmentSettings(m_dhttpMethod, agentID);
}));
#else
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("POST", retVal["EnvironmentSettings"],
m_dhttpMethod => SetEnvironment(m_dhttpMethod, agentID)));
//Sets the windlight settings
server.AddStreamHandler(new RestHTTPHandler("GET", retVal["EnvironmentSettings"],
m_dhttpMethod => EnvironmentSettings(m_dhttpMethod, agentID)));
#endif
return retVal;
}
示例6: AssetServiceConnector
public AssetServiceConnector(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("LocalServiceModule",
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);
bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
}
示例7: HeloServiceInConnector
public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
#pragma warning disable 0612
server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
#pragma warning restore 0612
server.AddStreamHandler(new HeloServerHeadHandler("opensim-robust"));
}
示例8: GridInfoServerInConnector
// private string m_ConfigName = "GridInfoService";
public GridInfoServerInConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
GridInfoHandlers handlers = new GridInfoHandlers(config);
server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
handlers.RestGetGridInfoMethod));
server.AddStreamHandler(new RestStreamHandler("GET", "/json_grid_info",
handlers.JsonGetGridInfoMethod));
server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod);
}
示例9: FinishedStartup
public void FinishedStartup ()
{
_server = _registry.RequestModuleInterface<ISimulationBase> ().GetHttpServer (0);
if (_server != null) {
_server.AddStreamHandler (new GenericStreamHandler ("GET", "/index.php?method=GridTexture", OnHTTPGetTextureImage));
_server.AddStreamHandler (new GenericStreamHandler ("GET", "/index.php?method=AvatarTexture", OnHTTPGetAvatarImage));
_registry.RegisterModuleInterface<IWebHttpTextureService> (this);
}
IGridInfo gridInfo = _registry.RequestModuleInterface<IGridInfo> ();
_gridNick = gridInfo != null
? gridInfo.GridName
: "No Grid Name Available, please set this";
}
示例10: SimulationServiceInConnector
// private IAuthenticationService m_AuthenticationService;
public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) :
base(config, server, String.Empty)
{
m_LocalSimulationService = scene.RequestModuleInterface<ISimulationService>();
m_LocalSimulationService = m_LocalSimulationService.GetInnerService();
// This one MUST be a stream handler because compressed fatpacks
// are pure binary and shoehorning that into a string with UTF-8
// encoding breaks it
server.AddStreamHandler(new AgentPostHandler(m_LocalSimulationService));
server.AddStreamHandler(new AgentPutHandler(m_LocalSimulationService));
server.AddHTTPHandler("/agent/", new AgentHandler(m_LocalSimulationService).Handler);
server.AddHTTPHandler("/object/", new ObjectHandler(m_LocalSimulationService).Handler);
}
示例11: AssetServiceConnector
public AssetServiceConnector(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("LocalServiceModule",
String.Empty);
if (assetService == String.Empty)
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config, m_ConfigName };
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));
bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
MainConsole.Instance.Commands.AddCommand("Assets", false,
"show asset",
"show asset <ID>",
"Show asset information",
HandleShowAsset);
MainConsole.Instance.Commands.AddCommand("Assets", false,
"delete asset",
"delete asset <ID>",
"Delete asset from database",
HandleDeleteAsset);
MainConsole.Instance.Commands.AddCommand("Assets", false,
"dump asset",
"dump asset <ID>",
"Dump asset to a file",
"The filename is the same as the ID given.",
HandleDumpAsset);
}
示例12: XInventoryInConnector
public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
if (configName != String.Empty)
m_ConfigName = configName;
m_log.DebugFormat("[XInventoryInConnector]: Starting with config name {0}", m_ConfigName);
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
string inventoryService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (inventoryService == String.Empty)
throw new Exception("No InventoryService in config file");
Object[] args = new Object[] { config, m_ConfigName };
m_InventoryService =
ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth));
}
示例13: UploadBakedTextureServerConnector
public UploadBakedTextureServerConnector(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));
// NEED TO FIX THIS
OpenSim.Framework.Capabilities.Caps caps = new OpenSim.Framework.Capabilities.Caps(server, "", server.Port, "", UUID.Zero, "");
server.AddStreamHandler(new RestStreamHandler(
"POST",
"/CAPS/UploadBakedTexture/",
new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
"UploadBakedTexture",
"Upload Baked Texture Capability"));
}
示例14: GetMeshServerConnector
public GetMeshServerConnector(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("GetMeshRedirectURL");
GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
IRequestHandler reqHandler
= new RestHTTPHandler(
"GET",
"/CAPS/" + UUID.Random(),
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
"GetMesh",
null);
server.AddStreamHandler(reqHandler); ;
}
示例15: MapAddServiceConnector
public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
string mapService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (mapService == String.Empty)
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config };
m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);
string gridService = serverConfig.GetString("GridService", String.Empty);
if (gridService != string.Empty)
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
if (m_GridService != null)
m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
else
m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
bool proxy = serverConfig.GetBoolean("HasProxy", false);
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth));
}