本文整理汇总了C#中IHttpServer.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpServer.AddHandler方法的具体用法?C# IHttpServer.AddHandler怎么用?C# IHttpServer.AddHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpServer
的用法示例。
在下文中一共展示了IHttpServer.AddHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start(IScene scene)
{
m_scene = scene;
m_lastCameraPositions = new Dictionary<uint, Vector3>();
m_borderCrossThrottles = new Dictionary<UUID, int>();
// Create an AABB for this scene that extends beyond the borders by BORDER_CROSS_THRESHOLD
// that is used to check for border crossings
m_borderCrossAABB = new AABB(Vector3.Zero, new Vector3(scene.MaxPosition - scene.MinPosition));
m_borderCrossAABB.Min -= new Vector3(BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD);
m_borderCrossAABB.Max += new Vector3(BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD, BORDER_CROSS_THRESHOLD);
m_scheduler = m_scene.Simian.GetAppModule<IScheduler>();
if (m_scheduler == null)
{
m_log.Warn("Neighbors requires an IScheduler");
return;
}
m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
if (m_httpServer == null)
{
m_log.Warn("Neighbors requires an IHttpServer");
return;
}
m_udp = m_scene.GetSceneModule<LLUDP>();
if (m_udp == null)
{
m_log.Warn("Neighbors requires an LLUDP");
return;
}
m_userClient = m_scene.Simian.GetAppModule<IUserClient>();
if (m_userClient == null)
{
m_log.Warn("Neighbors requires an IUserClient");
return;
}
m_gridClient = scene.Simian.GetAppModule<IGridClient>();
// Add neighbor messaging handlers
string urlFriendlySceneName = WebUtil.UrlEncode(scene.Name);
string regionPath = "/regions/" + urlFriendlySceneName;
m_httpServer.AddHandler("POST", null, regionPath + "/region/online", true, true, RegionOnlineHandler);
m_httpServer.AddHandler("POST", null, regionPath + "/region/offline", true, true, RegionOfflineHandler);
m_httpServer.AddHandler("POST", null, regionPath + "/child_avatar/update", true, true, ChildAvatarUpdateHandler);
m_scene.AddPublicCapability("region/online", m_httpServer.HttpAddress.Combine(regionPath + "/region/online"));
m_scene.AddPublicCapability("region/offline", m_httpServer.HttpAddress.Combine(regionPath + "/region/offline"));
m_scene.AddPublicCapability("child_avatar/update", m_httpServer.HttpAddress.Combine(regionPath + "/child_avatar/update"));
// Track local scenes going up and down
m_sceneFactory = scene.Simian.GetAppModule<ISceneFactory>();
if (m_sceneFactory != null)
{
m_sceneFactory.OnSceneStart += SceneStartHandler;
m_sceneFactory.OnSceneStop += SceneStopHandler;
}
m_scene.OnPresenceAdd += PresenceAddHandler;
m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler;
m_childUpdates = new ThrottledQueue<uint, IScenePresence>(5.0f, 200, true, SendChildUpdate);
m_childUpdates.Start();
}
示例2: Start
public void Start(IScene scene)
{
m_scene = scene;
m_httpServer = m_scene.Simian.GetAppModule<IHttpServer>();
if (m_httpServer == null)
{
m_log.Warn("RezAvatar requires an IHttpServer");
return;
}
m_userClient = m_scene.Simian.GetAppModule<IUserClient>();
if (m_userClient == null)
{
m_log.Warn("RezAvatar requires an IUserClient");
return;
}
m_lludp = scene.GetSceneModule<LLUDP>();
if (m_lludp == null)
{
m_log.Error("Can't create the RegionDomain service without an LLUDP server");
return;
}
string urlFriendlySceneName = WebUtil.UrlEncode(m_scene.Name);
string regionPath = "/regions/" + urlFriendlySceneName;
m_httpServer.AddHandler("POST", null, regionPath + "/rez_avatar/request", true, true, RezAvatarRequestHandler);
m_scene.AddPublicCapability("rez_avatar/request", m_httpServer.HttpAddress.Combine(regionPath + "/rez_avatar/request"));
}