Package org.atmosphere.cpr
Class DefaultAsyncSupportResolver
java.lang.Object
org.atmosphere.cpr.DefaultAsyncSupportResolver
- All Implemented Interfaces:
AsyncSupportResolver
This is the default implementation of @link {AsyncSupportResolver}.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAsyncSupport<?> defaultCometSupport(boolean preferBlocking) This method is used to determine the default AsyncSupport if all else fails.List<Class<? extends AsyncSupport<?>>> 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 booleantestClassExists(String testClass) Convenience method that tests if a class with the given FQN is present on the classpath.
-
Field Details
-
SERVLET_30
- See Also:
-
JSR356_WEBSOCKET
- See Also:
-
-
Constructor Details
-
DefaultAsyncSupportResolver
-
-
Method Details
-
testClassExists
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
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
This method is used to determine the default AsyncSupport if all else fails.- Parameters:
preferBlocking-- Returns:
-
newCometSupport
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
-
resolve
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
-
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
-