Package org.red5.net.websocket
Class WebSocketPlugin
- java.lang.Object
-
- org.red5.server.plugin.Red5Plugin
-
- org.red5.net.websocket.WebSocketPlugin
-
- All Implemented Interfaces:
org.red5.server.api.plugin.IRed5Plugin
public class WebSocketPlugin extends org.red5.server.plugin.Red5Plugin
WebSocketPlugin - centralized WebSocket configuration and locator.
This plugin will be called by Red5 plugin launcher to associate application components with WebSockets.- Author:
- Paul Gregoire
-
-
Constructor Summary
Constructors Constructor Description WebSocketPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doStart()
void
doStop()
static String[]
getAllowedOrigins()
org.red5.server.api.scope.IScope
getApplicationScope(String path)
Returns the application scope for a given path.WebSocketScopeManager
getManager(String path)
Returns a WebSocketScopeManager for a given path.WebSocketScopeManager
getManager(org.red5.server.api.scope.IScope scope)
Returns a WebSocketScopeManager for a given scope.String
getName()
org.red5.server.Server
getServer()
static javax.websocket.server.ServerEndpointConfig.Configurator
getWsConfiguratorInstance()
Returns an new instance of the configurator.DefaultWsServerContainer
getWsServerContainer(String path)
Returns a DefaultWsServerContainer for a given path.static javax.websocket.server.ServerContainer
getWsServerContainerInstance(javax.servlet.ServletContext servletContext)
Returns a new instance of WsServerContainer if one does not already exist.static boolean
isCrossOriginPolicy()
static boolean
isSameOriginPolicy()
WebSocketScopeManager
removeManager(org.red5.server.api.scope.IScope scope)
Removes and returns the WebSocketScopeManager for the given scope if it exists and returns null if it does not.void
setAllowedOrigins(String[] allowedOrigins)
void
setApplication(org.red5.server.adapter.MultiThreadedApplicationAdapter application)
void
setCrossOriginPolicy(boolean crossOriginPolicy)
void
setSameOriginPolicy(boolean sameOriginPolicy)
static Future<?>
submit(Runnable task)
Submit a task for execution.
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
doStart
public void doStart() throws Exception
- Specified by:
doStart
in interfaceorg.red5.server.api.plugin.IRed5Plugin
- Overrides:
doStart
in classorg.red5.server.plugin.Red5Plugin
- Throws:
Exception
-
doStop
public void doStop() throws Exception
- Specified by:
doStop
in interfaceorg.red5.server.api.plugin.IRed5Plugin
- Overrides:
doStop
in classorg.red5.server.plugin.Red5Plugin
- Throws:
Exception
-
submit
public static Future<?> submit(Runnable task)
Submit a task for execution.- Parameters:
task
-- Returns:
- Future
-
getName
public String getName()
- Specified by:
getName
in interfaceorg.red5.server.api.plugin.IRed5Plugin
- Overrides:
getName
in classorg.red5.server.plugin.Red5Plugin
-
getServer
public org.red5.server.Server getServer()
- Overrides:
getServer
in classorg.red5.server.plugin.Red5Plugin
-
getApplicationScope
public org.red5.server.api.scope.IScope getApplicationScope(String path)
Returns the application scope for a given path.- Parameters:
path
-- Returns:
- IScope
-
getManager
public WebSocketScopeManager getManager(org.red5.server.api.scope.IScope scope)
Returns a WebSocketScopeManager for a given scope.- Parameters:
scope
-- Returns:
- WebSocketScopeManager if registered for the given scope and null otherwise
-
getManager
public WebSocketScopeManager getManager(String path)
Returns a WebSocketScopeManager for a given path.- Parameters:
path
-- Returns:
- WebSocketScopeManager if registered for the given path and null otherwise
-
removeManager
public WebSocketScopeManager removeManager(org.red5.server.api.scope.IScope scope)
Removes and returns the WebSocketScopeManager for the given scope if it exists and returns null if it does not.- Parameters:
scope
- Scope for which the manager is registered- Returns:
- WebSocketScopeManager if registered for the given path and null otherwise
-
getWsServerContainer
public DefaultWsServerContainer getWsServerContainer(String path)
Returns a DefaultWsServerContainer for a given path.- Parameters:
path
-- Returns:
- DefaultWsServerContainer
-
setApplication
public void setApplication(org.red5.server.adapter.MultiThreadedApplicationAdapter application)
- Overrides:
setApplication
in classorg.red5.server.plugin.Red5Plugin
-
isSameOriginPolicy
public static boolean isSameOriginPolicy()
-
setSameOriginPolicy
public void setSameOriginPolicy(boolean sameOriginPolicy)
-
isCrossOriginPolicy
public static boolean isCrossOriginPolicy()
-
setCrossOriginPolicy
public void setCrossOriginPolicy(boolean crossOriginPolicy)
-
getAllowedOrigins
public static String[] getAllowedOrigins()
-
setAllowedOrigins
public void setAllowedOrigins(String[] allowedOrigins)
-
getWsConfiguratorInstance
public static javax.websocket.server.ServerEndpointConfig.Configurator getWsConfiguratorInstance()
Returns an new instance of the configurator.- Returns:
- configurator
-
getWsServerContainerInstance
public static javax.websocket.server.ServerContainer getWsServerContainerInstance(javax.servlet.ServletContext servletContext)
Returns a new instance of WsServerContainer if one does not already exist.- Parameters:
servletContext
-- Returns:
- WsServerContainer
-
-