public class VaadinServletService extends VaadinService {
private final VaadinServlet servlet;
- private final static boolean atmosphereAvailable = checkAtmosphereSupport();
+ private boolean atmosphereAvailable = checkAtmosphereSupport();
/**
* Keeps track of whether a warning about missing push support has already
private static boolean checkAtmosphereSupport() {
try {
String rawVersion = Version.getRawVersion();
- if (!Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION.equals(rawVersion)) {
+ if (!Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION
+ .equals(rawVersion)) {
getLogger().log(
Level.WARNING,
Constants.INVALID_ATMOSPHERE_VERSION_WARNING,
- new Object[] { Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION,
+ new Object[] {
+ Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION,
rawVersion });
}
return true;
handlers.add(0, new ServletBootstrapHandler());
handlers.add(new ServletUIInitHandler());
if (atmosphereAvailable) {
- handlers.add(new PushRequestHandler(this));
+ try {
+ handlers.add(new PushRequestHandler(this));
+ } catch (ServiceException e) {
+ // Atmosphere init failed. Push won't work but we don't throw a
+ // service exception as we don't want to prevent non-push
+ // applications from working
+ getLogger()
+ .log(Level.WARNING,
+ "Error initializing Atmosphere. Push will not work.",
+ e);
+ atmosphereAvailable = false;
+ }
}
return handlers;
}
trackMessageSize.configure(atmosphere.getAtmosphereConfig());
atmosphere.interceptor(trackMessageSize);
} catch (ServletException e) {
- throw new ServiceException("Could not read atmosphere settings", e);
+ throw new ServiceException("Atmosphere init failed", e);
}
}