本文整理汇总了Java中org.red5.server.api.scope.IScope.getContextPath方法的典型用法代码示例。如果您正苦于以下问题:Java IScope.getContextPath方法的具体用法?Java IScope.getContextPath怎么用?Java IScope.getContextPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.api.scope.IScope
的用法示例。
在下文中一共展示了IScope.getContextPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeScope
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Create a web socket scope from a server IScope. Use the IWebSocketScopeListener interface to configure the created scope.
*
* @param scope
*/
public void makeScope(IScope scope) {
log.debug("makeScope: {}", scope);
String path = scope.getContextPath();
WebSocketScope wsScope = null;
if (!scopes.containsKey(path)) {
// add the name to the collection (no '/' prefix)
activeRooms.add(scope.getName());
// new websocket scope for the server scope
wsScope = new WebSocketScope();
wsScope.setPath(path);
wsScope.setScope(scope);
notifyListeners(WebSocketEvent.SCOPE_CREATED, wsScope);
addWebSocketScope(wsScope);
log.debug("Use the IWebSocketScopeListener interface to be notified of new scopes");
} else {
log.debug("Scope already exists: {}", path);
}
}
示例2: SharedObjectScope
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Creates shared object with given parent scope, name, persistence flag state and store object
*
* @param parent
* Parent scope
* @param name
* Name
* @param persistent
* Persistence flag state
* @param store
* Persistence store
*/
public SharedObjectScope(IScope parent, String name, boolean persistent, IPersistenceStore store) {
super(parent, ScopeType.SHARED_OBJECT, name, persistent);
// create shared object wrapper around the attributes
String path = parent.getContextPath();
if ("".equals(path) || path.charAt(0) != '/') {
path = '/' + path;
}
log.trace("Path+name: {}/{}", path, name);
// Load SO
so = (SharedObject) store.load(ScopeType.SHARED_OBJECT + path + '/' + name);
// Create if it doesn't exist
if (so == null) {
so = new SharedObject(name, path, persistent, store);
// Save
store.save(so);
} else {
// set path
so.setPath(path);
}
}
示例3: route
import org.red5.server.api.scope.IScope; //导入方法依赖的package包/类
/**
* Routes a message on a given scope to the associated websocket connections.
*
* @param scope
* @param message
*/
public void route(IScope scope, String message)
{
// scope.path = /default scope.name = chat
String path = scope.getContextPath();
log.debug("Route to WebSocket: {} with {}", path, message);
if (getSharedObject(path) == null) {
log.warn("Shared object for path: {} did not exist", path);
}
if (wsListener != null) {
wsListener.sendToAll(scope.getContextPath(), message);
}
}