org.atmosphere.cpr
Class AtmosphereConfig

java.lang.Object
  extended by org.atmosphere.cpr.AtmosphereConfig

public class AtmosphereConfig
extends Object

This class contains information about the current state of the AtmosphereFramework. You can also register a AtmosphereConfig.ShutdownHook.

Author:
Sebastien Dionne : [email protected], Jeanfrancois Arcand

Nested Class Summary
static interface AtmosphereConfig.ShutdownHook
          A shutdown hook that will be called when the AtmosphereFramework.destroy() method gets invoked.
static interface AtmosphereConfig.StartupHook
          A Startup hook that will be called when the AtmosphereFramework.init() method complete.
 
Field Summary
protected static org.slf4j.Logger logger
           
protected  List<AtmosphereConfig.ShutdownHook> shutdownHooks
           
protected  List<AtmosphereConfig.StartupHook> startUpHook
           
 
Constructor Summary
AtmosphereConfig(AtmosphereFramework framework)
           
 
Method Summary
protected  void destroy()
          Invoke AtmosphereConfig.ShutdownHooks.
 AtmosphereFramework framework()
          Return the AtmosphereFramework.
 List<AtmosphereHandlerConfig> getAtmosphereHandlerConfig()
           
 BroadcasterFactory getBroadcasterFactory()
          Return an instance of DefaultBroadcasterFactory.
 String getInitParameter(String name)
          Return the value of the init params defined in web.xml or application.xml.
 boolean getInitParameter(String key, boolean defaultValue)
           
 int getInitParameter(String key, int defaultValue)
          Return an init-param, or its default value.
 String getInitParameter(String key, String defaultValue)
          Return an init-param, or its default value.
 Enumeration<String> getInitParameterNames()
          Return all init param.
 javax.servlet.ServletConfig getServletConfig()
          Return the ServletConfig.
 javax.servlet.ServletContext getServletContext()
          Return the ServletContext.
 String getWebServerName()
          Return the current WebServer used.
 Map<String,AtmosphereFramework.AtmosphereHandlerWrapper> handlers()
          Return the list of AtmosphereFramework.AtmosphereHandlerWrappers.
protected  void initComplete()
          Invoke AtmosphereConfig.ShutdownHooks.
 boolean isSessionTimeoutRemovalAllowed()
          Allow HTTP session timeout removal when session support is active
 boolean isSupportSession()
          Is HttpSession supported.
 boolean isThrowExceptionOnCloned()
          Is cloned request throws exception.
 MetaBroadcaster metaBroadcaster()
           
 Map<String,Object> properties()
          Return the Map of Applications's properties.
 AtmosphereResourceFactory resourcesFactory()
           
 void setSessionTimeoutRemovalAllowed(boolean sessionTimeoutRemovalAllowed)
          Enable/Disable HttpSession timeout removal when a connection exists.
 void setSupportSession(boolean supportSession)
          Enable/Disable HttpSession.
 void setThrowExceptionOnCloned(boolean throwExceptionOnCloned)
          Enable/Disable Exception on cloned request.
 AtmosphereConfig shutdownHook(AtmosphereConfig.ShutdownHook s)
          Add a AtmosphereConfig.ShutdownHook.
 AtmosphereConfig startupHook(AtmosphereConfig.StartupHook s)
          Add a AtmosphereConfig.StartupHook.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.slf4j.Logger logger

shutdownHooks

protected final List<AtmosphereConfig.ShutdownHook> shutdownHooks

startUpHook

protected final List<AtmosphereConfig.StartupHook> startUpHook
Constructor Detail

AtmosphereConfig

public AtmosphereConfig(AtmosphereFramework framework)
Method Detail

getAtmosphereHandlerConfig

public List<AtmosphereHandlerConfig> getAtmosphereHandlerConfig()

framework

public AtmosphereFramework framework()
Return the AtmosphereFramework.

Returns:
the AtmosphereFramework

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Return the ServletConfig.

Returns:
ServletConfig

getServletContext

public javax.servlet.ServletContext getServletContext()
Return the ServletContext.

Returns:
ServletContext

getWebServerName

public String getWebServerName()
Return the current WebServer used.

Returns:
the current WebServer used

handlers

public Map<String,AtmosphereFramework.AtmosphereHandlerWrapper> handlers()
Return the list of AtmosphereFramework.AtmosphereHandlerWrappers.

Returns:
the list of AtmosphereFramework.AtmosphereHandlerWrapper

getInitParameter

public String getInitParameter(String name)
Return the value of the init params defined in web.xml or application.xml.

Parameters:
name - the name
Returns:
the list of init params defined in web.xml or application.xml

getInitParameterNames

public Enumeration<String> getInitParameterNames()
Return all init param.

Returns:

isSupportSession

public boolean isSupportSession()
Is HttpSession supported.

Returns:
HttpSession supported.

setSupportSession

public void setSupportSession(boolean supportSession)
Enable/Disable HttpSession.

Parameters:
supportSession - true to enable, false to disable

isSessionTimeoutRemovalAllowed

public boolean isSessionTimeoutRemovalAllowed()
Allow HTTP session timeout removal when session support is active

Returns:
HTTP session timeout removal allowed.

setSessionTimeoutRemovalAllowed

public void setSessionTimeoutRemovalAllowed(boolean sessionTimeoutRemovalAllowed)
Enable/Disable HttpSession timeout removal when a connection exists.

Parameters:
sessionTimeoutRemovalAllowed - true to enable, false to disable

isThrowExceptionOnCloned

public boolean isThrowExceptionOnCloned()
Is cloned request throws exception.

Returns:
Cloned Request's exception supported.

setThrowExceptionOnCloned

public void setThrowExceptionOnCloned(boolean throwExceptionOnCloned)
Enable/Disable Exception on cloned request.

Parameters:
throwExceptionOnCloned -

getBroadcasterFactory

public BroadcasterFactory getBroadcasterFactory()
Return an instance of DefaultBroadcasterFactory.

Returns:
an instance of DefaultBroadcasterFactory

properties

public Map<String,Object> properties()
Return the Map of Applications's properties.

Returns:
the Map of Applications's properties

destroy

protected void destroy()
Invoke AtmosphereConfig.ShutdownHooks.


initComplete

protected void initComplete()
Invoke AtmosphereConfig.ShutdownHooks.


shutdownHook

public AtmosphereConfig shutdownHook(AtmosphereConfig.ShutdownHook s)
Add a AtmosphereConfig.ShutdownHook.

Parameters:
s - a AtmosphereConfig.ShutdownHook
Returns:
this

startupHook

public AtmosphereConfig startupHook(AtmosphereConfig.StartupHook s)
Add a AtmosphereConfig.StartupHook.

Parameters:
s - a AtmosphereConfig.StartupHook
Returns:
this

getInitParameter

public String getInitParameter(String key,
                               String defaultValue)
Return an init-param, or its default value.

Parameters:
key -
defaultValue -
Returns:

getInitParameter

public int getInitParameter(String key,
                            int defaultValue)
Return an init-param, or its default value.

Parameters:
key -
defaultValue -
Returns:

getInitParameter

public boolean getInitParameter(String key,
                                boolean defaultValue)

resourcesFactory

public AtmosphereResourceFactory resourcesFactory()

metaBroadcaster

public MetaBroadcaster metaBroadcaster()


Copyright © 2014. All Rights Reserved.