org.atmosphere.cpr
Class DefaultAsyncSupportResolver

java.lang.Object
  extended by org.atmosphere.cpr.DefaultAsyncSupportResolver
All Implemented Interfaces:
AsyncSupportResolver

public class DefaultAsyncSupportResolver
extends Object
implements AsyncSupportResolver

This is the default implementation of @link {AsyncSupportResolver}.

Author:
Viktor Klang

Field Summary
static String GLASSFISH_V2
           
static String GRIZZLY
           
static String GRIZZLY_WEBSOCKET
           
static String GRIZZLY2
           
static String GRIZZLY2_WEBSOCKET
           
static String JBOSS_5
           
static String JBOSS_AS7_WEBSOCKET
           
static String JBOSSWEB
           
static String JETTY
           
static String JETTY_7
           
static String JETTY_8
           
static String JETTY_9
           
static String JSR356_WEBSOCKET
           
static String NETTY
           
static String SERVLET_30
           
static String TOMCAT
           
static String TOMCAT_7
           
static String TOMCAT_WEBSOCKET
           
static String WEBLOGIC_WEBSOCKWET
           
 
Constructor Summary
DefaultAsyncSupportResolver(AtmosphereConfig config)
           
 
Method Summary
 AsyncSupport defaultCometSupport(boolean preferBlocking)
          This method is used to determine the default AsyncSupport if all else fails.
 List<Class<? extends AsyncSupport>> detectContainersPresent()
          Returns a list of comet support by containers available on the classpath.
 List<Class<? extends AsyncSupport>> detectWebSocketPresent(boolean useNativeIfPossible, boolean useServlet30Async)
           
 AsyncSupport newCometSupport(Class<? extends AsyncSupport> targetClass)
          Given a Class of something that extends AsyncSupport, it tries to return an instance of that class.
 AsyncSupport newCometSupport(String targetClassFQN)
           
 AsyncSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking)
          This method is the general interface to the outside world.
 AsyncSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking, boolean useServlet30Async)
           
protected  AsyncSupport resolveMultipleNativeSupportConflict(List<Class<? extends AsyncSupport>> available)
          This method is called if there are more than one potential native container in scope.
protected  AsyncSupport resolveNativeCometSupport(List<Class<? extends AsyncSupport>> available)
          This method is called to determine which native comet support to the used.
 AsyncSupport resolveWebSocket(List<Class<? extends AsyncSupport>> available)
           
protected  boolean testClassExists(String testClass)
          Convenience method that tests if a class with the given FQN is present on the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVLET_30

public static final String SERVLET_30
See Also:
Constant Field Values

GLASSFISH_V2

public static final String GLASSFISH_V2
See Also:
Constant Field Values

TOMCAT_7

public static final String TOMCAT_7
See Also:
Constant Field Values

TOMCAT_WEBSOCKET

public static final String TOMCAT_WEBSOCKET
See Also:
Constant Field Values

TOMCAT

public static final String TOMCAT
See Also:
Constant Field Values

JBOSS_5

public static final String JBOSS_5
See Also:
Constant Field Values

JETTY

public static final String JETTY
See Also:
Constant Field Values

JETTY_7

public static final String JETTY_7
See Also:
Constant Field Values

JETTY_8

public static final String JETTY_8
See Also:
Constant Field Values

JETTY_9

public static final String JETTY_9
See Also:
Constant Field Values

GRIZZLY

public static final String GRIZZLY
See Also:
Constant Field Values

GRIZZLY2

public static final String GRIZZLY2
See Also:
Constant Field Values

JBOSSWEB

public static final String JBOSSWEB
See Also:
Constant Field Values

GRIZZLY_WEBSOCKET

public static final String GRIZZLY_WEBSOCKET
See Also:
Constant Field Values

GRIZZLY2_WEBSOCKET

public static final String GRIZZLY2_WEBSOCKET
See Also:
Constant Field Values

NETTY

public static final String NETTY
See Also:
Constant Field Values

JBOSS_AS7_WEBSOCKET

public static final String JBOSS_AS7_WEBSOCKET
See Also:
Constant Field Values

JSR356_WEBSOCKET

public static final String JSR356_WEBSOCKET
See Also:
Constant Field Values

WEBLOGIC_WEBSOCKWET

public static final String WEBLOGIC_WEBSOCKWET
See Also:
Constant Field Values
Constructor Detail

DefaultAsyncSupportResolver

public DefaultAsyncSupportResolver(AtmosphereConfig config)
Method Detail

testClassExists

protected boolean testClassExists(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 List<Class<? extends AsyncSupport>> detectContainersPresent()
Returns a list of comet support by containers available on the classpath.

Returns:

detectWebSocketPresent

public List<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(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

newCometSupport

public AsyncSupport newCometSupport(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:
resolve in interface AsyncSupportResolver

resolveWebSocket

public AsyncSupport resolveWebSocket(List<Class<? extends AsyncSupport>> available)

resolveNativeCometSupport

protected AsyncSupport resolveNativeCometSupport(List<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(List<Class<? extends AsyncSupport>> available)
This method is called if there are more than one potential native container in scope.

Returns:
a AsyncSupport instance


Copyright © 2014. All Rights Reserved.