Package org.red5.server.scope
Class WebScope
- java.lang.Object
-
- org.red5.server.scope.BasicScope
-
- org.red5.server.scope.Scope
-
- org.red5.server.scope.WebScope
-
- All Implemented Interfaces:
Comparable<org.red5.server.scope.BasicScope>
,org.red5.server.api.event.IEventDispatcher
,org.red5.server.api.event.IEventHandler
,org.red5.server.api.event.IEventListener
,org.red5.server.api.event.IEventObservable
,org.red5.server.api.ICoreObject
,org.red5.server.api.scope.IBasicScope
,org.red5.server.api.scope.IScope
,org.red5.server.api.service.IServiceHandlerProvider
,org.red5.server.api.statistics.IScopeStatistics
,org.red5.server.api.statistics.IStatisticsBase
,org.red5.server.jmx.mxbeans.ScopeMXBean
,WebScopeMXBean
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.core.io.ResourceLoader
,org.springframework.core.io.support.ResourcePatternResolver
,org.springframework.web.context.ServletContextAware
@ManagedResource public class WebScope extends org.red5.server.scope.Scope implements org.springframework.web.context.ServletContextAware, WebScopeMXBean, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Web scope is special scope that is aware of servlet context and represents scope of a Red5 application within a servlet container (or application server) such as Tomcat, Jetty or JBoss.
Web scope is aware of virtual hosts configuration for Red5 application and is the first scope that instantiated after Red5 application gets started.
Then it loads virtual hosts configuration, adds mappings of paths to global scope that is injected thru Spring IoC context file and runs initialization process.
Red5 server implementation instance and ServletContext are injected as well.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.red5.server.api.IApplicationContext
appContext
The application context this webscope is running in.protected org.red5.server.api.IApplicationLoader
appLoader
Loader for new applications.protected String
contextPath
Context pathprotected String[]
hostnames
Hostnamesprotected static org.slf4j.Logger
log
Loggerprotected AtomicBoolean
registered
Has the web scope been registered?protected org.red5.server.api.IServer
server
Server instanceprotected javax.servlet.ServletContext
servletContext
Servlet contextprotected AtomicBoolean
shuttingDown
Is the scope currently shutting down?protected String
virtualHosts
Virtual hosts list as string-
Fields inherited from class org.red5.server.scope.Scope
attributes, connectionStats, oName, subscopeStats
-
-
Constructor Summary
Constructors Constructor Description WebScope()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
void
destroy()
org.red5.server.api.IApplicationLoader
getApplicationLoader()
Return object that can be used to load new applications.String
getContextPath()
Return scope context pathorg.red5.server.api.IServer
getServer()
boolean
isShuttingDown()
Is the scope currently shutting down?void
register()
Map all vhosts to global scope then initializevoid
setContextPath(String contextPath)
Setter for context pathvoid
setGlobalScope(org.red5.server.api.scope.IGlobalScope globalScope)
Setter for global scope.void
setName()
Web scope has no namevoid
setParent()
Can't set parent to Web scope.void
setServer(org.red5.server.api.IServer server)
Setter for servervoid
setServletContext(javax.servlet.ServletContext servletContext)
Servlet contextvoid
setVirtualHosts(String virtualHosts)
Setter for virtual hosts.void
unregister()
Uninitialize and remove all vhosts from the global scope.-
Methods inherited from class org.red5.server.scope.Scope
addChildScope, connect, connect, createChildScope, disconnect, dispatchEvent, dump, equals, from, getActiveClients, getActiveConnections, getActiveSubscopes, getAttribute, getAttributeNames, getAttributes, getBasicScope, getBasicScope, getBasicScopeNames, getBroadcastScope, getClassLoader, getClientConnections, getClients, getConnections, getContext, getCreationTime, getDepth, getEnabled, getHandler, getMaxClients, getMaxConnections, getMaxSubscopes, getParent, getPath, getResource, getResources, getRunning, getScope, getScopeNames, getServiceHandler, getServiceHandlerNames, getServiceHandlers, getServiceHandlers, getStatistics, getTotalClients, getTotalConnections, getTotalSubscopes, handleEvent, hasAttribute, hasChildScope, hasChildScope, hasContext, hasHandler, hashCode, hasParent, init, isEnabled, isRunning, lookupConnection, lookupConnections, registerJMX, registerServiceHandler, removeAttribute, removeChildren, removeChildScope, setAttribute, setAutoStart, setChildLoadPath, setContext, setDepth, setEnabled, setHandler, setName, setParent, setPersistenceClass, start, stop, toString, uninit, unregisterJMX, unregisterServiceHandler
-
Methods inherited from class org.red5.server.scope.BasicScope
addEventListener, compareTo, getEventListeners, getName, getStore, getType, hasEventListeners, isConnectionAllowed, isScopeAllowed, isValid, notifyEvent, removeEventListener, setKeepDelay, setSecurityHandlers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.red5.server.api.scope.IBasicScope
getName, getStore, getType, isConnectionAllowed, isScopeAllowed, isValid, setKeepDelay, setSecurityHandlers
-
Methods inherited from interface org.red5.server.api.event.IEventObservable
addEventListener, getEventListeners, removeEventListener
-
Methods inherited from interface org.red5.server.jmx.mxbeans.ScopeMXBean
createChildScope, getActiveClients, getActiveConnections, getActiveSubscopes, getDepth, getEnabled, getMaxClients, getMaxConnections, getMaxSubscopes, getPath, getRunning, getServiceHandlerNames, getTotalClients, getTotalConnections, getTotalSubscopes, hasChildScope, hasChildScope, hasContext, hasHandler, hasParent, init, setAutoStart, setChildLoadPath, setDepth, setEnabled, setName, setPersistenceClass, start, stop, unregisterServiceHandler
-
-
-
-
Field Detail
-
log
protected static org.slf4j.Logger log
Logger
-
server
protected transient org.red5.server.api.IServer server
Server instance
-
appContext
protected transient org.red5.server.api.IApplicationContext appContext
The application context this webscope is running in.
-
appLoader
protected transient org.red5.server.api.IApplicationLoader appLoader
Loader for new applications.
-
servletContext
protected transient javax.servlet.ServletContext servletContext
Servlet context
-
contextPath
protected String contextPath
Context path
-
virtualHosts
protected String virtualHosts
Virtual hosts list as string
-
hostnames
protected String[] hostnames
Hostnames
-
registered
protected AtomicBoolean registered
Has the web scope been registered?
-
shuttingDown
protected AtomicBoolean shuttingDown
Is the scope currently shutting down?
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
destroy
public void destroy() throws Exception
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Specified by:
destroy
in interfaceorg.red5.server.jmx.mxbeans.ScopeMXBean
- Overrides:
destroy
in classorg.red5.server.scope.Scope
- Throws:
Exception
-
setGlobalScope
public void setGlobalScope(org.red5.server.api.scope.IGlobalScope globalScope)
Setter for global scope. Sets persistence class.- Parameters:
globalScope
- Red5 global scope
-
setName
public void setName()
Web scope has no name
-
setParent
public void setParent()
Can't set parent to Web scope. Web scope is top level.
-
setServer
public void setServer(org.red5.server.api.IServer server)
Setter for server- Parameters:
server
- Server instance
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
Servlet context- Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
- Parameters:
servletContext
- Servlet context
-
setContextPath
public void setContextPath(String contextPath)
Setter for context path- Specified by:
setContextPath
in interfaceWebScopeMXBean
- Parameters:
contextPath
- Context path
-
getContextPath
public String getContextPath()
Return scope context path- Specified by:
getContextPath
in interfaceorg.red5.server.api.scope.IScope
- Specified by:
getContextPath
in interfaceorg.red5.server.jmx.mxbeans.ScopeMXBean
- Overrides:
getContextPath
in classorg.red5.server.scope.Scope
- Returns:
- Scope context path
-
setVirtualHosts
public void setVirtualHosts(String virtualHosts)
Setter for virtual hosts. Creates array of hostnames.- Specified by:
setVirtualHosts
in interfaceWebScopeMXBean
- Parameters:
virtualHosts
- Virtual hosts list as string
-
register
public void register()
Map all vhosts to global scope then initialize- Specified by:
register
in interfaceWebScopeMXBean
-
unregister
public void unregister()
Uninitialize and remove all vhosts from the global scope.- Specified by:
unregister
in interfaceWebScopeMXBean
-
getServer
public org.red5.server.api.IServer getServer()
- Overrides:
getServer
in classorg.red5.server.scope.Scope
-
getApplicationLoader
public org.red5.server.api.IApplicationLoader getApplicationLoader()
Return object that can be used to load new applications.- Returns:
- the application loader
-
isShuttingDown
public boolean isShuttingDown()
Is the scope currently shutting down?- Specified by:
isShuttingDown
in interfaceWebScopeMXBean
- Returns:
- is shutting down
-
-