Skip to content

Commit

Permalink
Make sure default interceptor gets initialized as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Jul 12, 2012
1 parent fabd4b9 commit b8f2264
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.atmosphere.di.ServletContextProvider;
import org.atmosphere.handler.AbstractReflectorAtmosphereHandler;
import org.atmosphere.handler.ReflectorServletProcessor;
import org.atmosphere.interceptor.AndroidAtmosphereInterceptor;
import org.atmosphere.interceptor.JSONPAtmosphereInterceptor;
import org.atmosphere.interceptor.SSEAtmosphereInterceptor;
import org.atmosphere.util.AtmosphereConfigReader;
Expand Down Expand Up @@ -550,13 +551,26 @@ protected void configureAtmosphereInterceptor(ServletConfig sc) {
s = sc.getInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR);
if (s == null) {
// ADD JSONP support
interceptors.addFirst(new JSONPAtmosphereInterceptor());
interceptors.addFirst(newAInterceptor(JSONPAtmosphereInterceptor.class));
// Add SSE support
interceptors.addFirst(new SSEAtmosphereInterceptor());
interceptors.addFirst(newAInterceptor(SSEAtmosphereInterceptor.class));
// Android 2.3.x streaming support
interceptors.addFirst(newAInterceptor(AndroidAtmosphereInterceptor.class));
}
logger.info("Installed AtmosphereInterceptor {}", interceptors);
}

protected AtmosphereInterceptor newAInterceptor(Class<? extends AtmosphereInterceptor> a) {
AtmosphereInterceptor ai = null;
try {
ai = (AtmosphereInterceptor) getClass().getClassLoader().loadClass(a.getName()).newInstance();
ai.configure(config);
} catch (Exception ex) {
logger.warn("", ex);
}
return ai;
}

protected void configureWebDotXmlAtmosphereHandler(ServletConfig sc) {
String s = sc.getInitParameter(ATMOSPHERE_HANDLER);
if (s != null) {
Expand Down

0 comments on commit b8f2264

Please sign in to comment.