/** * Add a filter class. * * @param klass the filter class * @param urlPattern the URL pattern for requests that should be handled by instances of {@code * klass} * @return a {@link FilterConfiguration} instance allowing for further configuration */ public FilterConfiguration addFilter(Class<? extends Filter> klass, String urlPattern) { final FilterHolder holder = new FilterHolder(checkNotNull(klass)); final FilterConfiguration configuration = new FilterConfiguration(holder, filters); configuration.addUrlPattern(checkNotNull(urlPattern)); return configuration; }
/** * Add a filter instance. * * @param filter the filter instance * @param urlPattern the URL pattern for requests that should be handled by {@code filter} * @return a {@link FilterConfiguration} instance allowing for further configuration */ public FilterConfiguration addFilter(Filter filter, String urlPattern) { final FilterHolder holder = new FilterHolder(checkNotNull(filter)); final FilterConfiguration configuration = new FilterConfiguration(holder, filters); configuration.addUrlPattern(checkNotNull(urlPattern)); return configuration; }