@Test public void addInterceptors() { AtmosphereInterceptorWriter writer = new AtmosphereInterceptorWriter(); TestFilter[] filters = new TestFilter[4]; for (int i = 0; i < 4; i++) { filters[i] = new TestFilter(); } writer.interceptor(filters[0]); writer.interceptor(filters[1]); verifyInterceptors(writer, new AsyncIOInterceptor[]{filters[0], filters[1]}); writer.interceptor(filters[2], 0); verifyInterceptors(writer, new AsyncIOInterceptor[]{filters[2], filters[0], filters[1]}); writer.interceptor(filters[3], 2); verifyInterceptors(writer, new AsyncIOInterceptor[]{filters[2], filters[0], filters[3], filters[1]}); writer.interceptor(filters[2], 2); verifyInterceptors(writer, new AsyncIOInterceptor[]{filters[2], filters[0], filters[3], filters[1]}); }
public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) { if (!filters.contains(filter)) { logger.trace("Adding AsyncIOInterceptor {}", filter.getClass().getName()); filters.addLast(filter); reversedFilters.addFirst(filter); } return this; }
AtmosphereInterceptorWriter extends AsyncIOWriterAdapter { public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) { if (!filters.contains(filter)) { logger.trace("Adding AsyncIOInterceptor {}", filter.getClass().getName()); filters.addLast(filter); reversedFilters.addFirst(filter); } return this; } }
AtmosphereInterceptorWriter extends AsyncIOWriterAdapter { public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) { if (!filters.contains(filter)) { logger.trace("Adding AsyncIOInterceptor {}", filter.getClass().getName()); filters.addLast(filter); reversedFilters.addFirst(filter); } return this; } AtmosphereInterceptorWriter(); }
AtmosphereInterceptorWriter extends AsyncIOWriterAdapter { public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) { if (!filters.contains(filter)) { logger.trace("Adding AsyncIOInterceptor {}", filter.getClass().getName()); filters.addLast(filter); reversedFilters.addFirst(filter); } return this; } AtmosphereInterceptorWriter(); @Override AsyncIOWriter redirect(AtmosphereResponse response, String location); @Override AsyncIOWriter writeError(AtmosphereResponse response, int errorCode, String message); @Override AsyncIOWriter write(AtmosphereResponse response, String data); @Override AsyncIOWriter write(AtmosphereResponse response, byte[] data); @Override AsyncIOWriter write(AtmosphereResponse response, byte[] data, int offset, int length); @Override void close(AtmosphereResponse response); @Override AsyncIOWriter flush(AtmosphereResponse response); AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter); AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter, int index); LinkedList<AsyncIOInterceptor> filters(); }
AtmosphereInterceptorWriter extends AsyncIOWriterAdapter { public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) { if (!filters.contains(filter)) { logger.trace("Adding AsyncIOInterceptor {}", filter.getClass().getName()); filters.addLast(filter); reversedFilters.addFirst(filter); } return this; } AtmosphereInterceptorWriter(); @Override AsyncIOWriter redirect(AtmosphereResponse response, String location); @Override AsyncIOWriter writeError(AtmosphereResponse response, int errorCode, String message); @Override AsyncIOWriter write(AtmosphereResponse response, String data); @Override AsyncIOWriter write(AtmosphereResponse response, byte[] data); @Override AsyncIOWriter write(AtmosphereResponse response, byte[] data, int offset, int length); @Override void close(AtmosphereResponse response); @Override AsyncIOWriter flush(AtmosphereResponse response); AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter); AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter, int index); LinkedList<AsyncIOInterceptor> filters();  }