Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #380 from survivant/master

avoid duplicate InterceptorService to be added
  • Loading branch information...
commit 8a305cc5fbafed888e570ad58bef0be76b826c03 2 parents e6d8d65 + de24792
@jfarcand jfarcand authored
View
14 modules/cpr/src/main/java/org/atmosphere/cpr/AtmosphereFramework.java
@@ -477,7 +477,7 @@ protected void configureAtmosphereInterceptor(ServletConfig sc) {
AtmosphereInterceptor ai = (AtmosphereInterceptor) Thread.currentThread().getContextClassLoader()
.loadClass(a.trim()).newInstance();
ai.configure(config);
- interceptors.add(ai);
+ interceptor(ai);
} catch (InstantiationException e) {
logger.warn("", e);
} catch (IllegalAccessException e) {
@@ -1347,7 +1347,17 @@ public AtmosphereFramework setHandlersPath(String handlersPath) {
* @return this
*/
public AtmosphereFramework interceptor(AtmosphereInterceptor c) {
- interceptors.addLast(c);
+ boolean found = false;
+ for (AtmosphereInterceptor interceptor : interceptors) {
+ if(interceptor.getClass().equals(c.getClass())){
+ found = true;
+ break;
+ }
+ }
+
+ if(!found){
+ interceptors.addLast(c);
+ }
return this;
}
Please sign in to comment.
Something went wrong with that request. Please try again.