Package org.atmosphere.cpr
Class DefaultAsyncSupportResolver
- java.lang.Object
-
- org.atmosphere.cpr.DefaultAsyncSupportResolver
-
- All Implemented Interfaces:
AsyncSupportResolver
public class DefaultAsyncSupportResolver extends java.lang.Object implements AsyncSupportResolver
This is the default implementation of @link {AsyncSupportResolver}.- Author:
- Viktor Klang
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGLASSFISH_V2static java.lang.StringGRIZZLYstatic java.lang.StringGRIZZLY_WEBSOCKETstatic java.lang.StringGRIZZLY2static java.lang.StringGRIZZLY2_WEBSOCKETstatic java.lang.StringHK2static java.lang.StringJBOSS_5static java.lang.StringJBOSS_AS7_WEBSOCKETstatic java.lang.StringJBOSSWEBstatic java.lang.StringJETTYstatic java.lang.StringJETTY_7static java.lang.StringJETTY_8static java.lang.StringJETTY_9static java.lang.StringJSR356_WEBSOCKETstatic java.lang.StringNETTYstatic java.lang.StringSERVLET_30static java.lang.StringTOMCATstatic java.lang.StringTOMCAT_7static java.lang.StringTOMCAT_WEBSOCKETstatic java.lang.StringWEBLOGIC_WEBSOCKET
-
Constructor Summary
Constructors Constructor Description DefaultAsyncSupportResolver(AtmosphereConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncSupportdefaultCometSupport(boolean preferBlocking)This method is used to determine the default AsyncSupport if all else fails.java.util.List<java.lang.Class<? extends AsyncSupport>>detectContainersPresent()Returns a list of comet support by containers available on the classpath.java.util.List<java.lang.Class<? extends AsyncSupport>>detectWebSocketPresent(boolean useNativeIfPossible, boolean useServlet30Async)AsyncSupportnewCometSupport(java.lang.Class<? extends AsyncSupport> targetClass)Given a Class of something that extends AsyncSupport, it tries to return an instance of that class.AsyncSupportnewCometSupport(java.lang.String targetClassFQN)AsyncSupportresolve(boolean useNativeIfPossible, boolean defaultToBlocking)This method is the general interface to the outside world.AsyncSupportresolve(boolean useNativeIfPossible, boolean defaultToBlocking, boolean useServlet30Async)protected AsyncSupportresolveMultipleNativeSupportConflict(java.util.List<java.lang.Class<? extends AsyncSupport>> available)This method is called if there are more than one potential native container in scope.protected AsyncSupportresolveNativeCometSupport(java.util.List<java.lang.Class<? extends AsyncSupport>> available)This method is called to determine which native comet support to the used.AsyncSupportresolveWebSocket(java.util.List<java.lang.Class<? extends AsyncSupport>> available)protected booleantestClassExists(java.lang.String testClass)Convenience method that tests if a class with the given FQN is present on the classpath.
-
-
-
Field Detail
-
SERVLET_30
public static final java.lang.String SERVLET_30
- See Also:
- Constant Field Values
-
GLASSFISH_V2
public static final java.lang.String GLASSFISH_V2
- See Also:
- Constant Field Values
-
TOMCAT_7
public static final java.lang.String TOMCAT_7
- See Also:
- Constant Field Values
-
TOMCAT_WEBSOCKET
public static final java.lang.String TOMCAT_WEBSOCKET
- See Also:
- Constant Field Values
-
TOMCAT
public static final java.lang.String TOMCAT
- See Also:
- Constant Field Values
-
JBOSS_5
public static final java.lang.String JBOSS_5
- See Also:
- Constant Field Values
-
JETTY
public static final java.lang.String JETTY
- See Also:
- Constant Field Values
-
JETTY_7
public static final java.lang.String JETTY_7
- See Also:
- Constant Field Values
-
JETTY_8
public static final java.lang.String JETTY_8
- See Also:
- Constant Field Values
-
JETTY_9
public static final java.lang.String JETTY_9
- See Also:
- Constant Field Values
-
GRIZZLY
public static final java.lang.String GRIZZLY
- See Also:
- Constant Field Values
-
GRIZZLY2
public static final java.lang.String GRIZZLY2
- See Also:
- Constant Field Values
-
JBOSSWEB
public static final java.lang.String JBOSSWEB
- See Also:
- Constant Field Values
-
GRIZZLY_WEBSOCKET
public static final java.lang.String GRIZZLY_WEBSOCKET
- See Also:
- Constant Field Values
-
GRIZZLY2_WEBSOCKET
public static final java.lang.String GRIZZLY2_WEBSOCKET
- See Also:
- Constant Field Values
-
NETTY
public static final java.lang.String NETTY
- See Also:
- Constant Field Values
-
JBOSS_AS7_WEBSOCKET
public static final java.lang.String JBOSS_AS7_WEBSOCKET
- See Also:
- Constant Field Values
-
JSR356_WEBSOCKET
public static final java.lang.String JSR356_WEBSOCKET
- See Also:
- Constant Field Values
-
WEBLOGIC_WEBSOCKET
public static final java.lang.String WEBLOGIC_WEBSOCKET
- See Also:
- Constant Field Values
-
HK2
public static final java.lang.String HK2
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultAsyncSupportResolver
public DefaultAsyncSupportResolver(AtmosphereConfig config)
-
-
Method Detail
-
testClassExists
protected boolean testClassExists(java.lang.String testClass)
Convenience method that tests if a class with the given FQN is present on the classpath.- Parameters:
testClass-- Returns:
- true if the class is present
-
detectContainersPresent
public java.util.List<java.lang.Class<? extends AsyncSupport>> detectContainersPresent()
Returns a list of comet support by containers available on the classpath.- Returns:
-
detectWebSocketPresent
public java.util.List<java.lang.Class<? extends AsyncSupport>> detectWebSocketPresent(boolean useNativeIfPossible, boolean useServlet30Async)
-
defaultCometSupport
public AsyncSupport defaultCometSupport(boolean preferBlocking)
This method is used to determine the default AsyncSupport if all else fails.- Parameters:
preferBlocking-- Returns:
-
newCometSupport
public AsyncSupport newCometSupport(java.lang.Class<? extends AsyncSupport> targetClass)
Given a Class of something that extends AsyncSupport, it tries to return an instance of that class. The class has to have a visible constructor with the signature (@link {AtmosphereConfig}).- Parameters:
targetClass-- Returns:
- an instance of the specified class or null if the class cannot be instantiated
-
newCometSupport
public AsyncSupport newCometSupport(java.lang.String targetClassFQN)
-
resolve
public AsyncSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking)
This method is the general interface to the outside world.- Parameters:
useNativeIfPossible- - should the resolver try to use a native container comet support if present?defaultToBlocking- - should the resolver default to blocking IO comet support?- Returns:
- an instance of AsyncSupport
-
resolve
public AsyncSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking, boolean useServlet30Async)
- Specified by:
resolvein interfaceAsyncSupportResolver
-
resolveWebSocket
public AsyncSupport resolveWebSocket(java.util.List<java.lang.Class<? extends AsyncSupport>> available)
-
resolveNativeCometSupport
protected AsyncSupport resolveNativeCometSupport(java.util.List<java.lang.Class<? extends AsyncSupport>> available)
This method is called to determine which native comet support to the used.- Parameters:
available-- Returns:
- the result of @link {resolveMultipleNativeSupportConflict} if there are more than 1 item in the list of available ontainers
-
resolveMultipleNativeSupportConflict
protected AsyncSupport resolveMultipleNativeSupportConflict(java.util.List<java.lang.Class<? extends AsyncSupport>> available)
This method is called if there are more than one potential native container in scope.- Returns:
- a AsyncSupport instance
-
-