ApplicationProviderBinder extends ProviderBinder { @Override public List<RequestFilter> getRequestFilters(String path) { ApplicationContext context = ApplicationContext.getCurrent(); List<RequestFilter> filters = doGetMatchedFilters(path, requestFilters).stream() .map(factory -> (RequestFilter)factory.getInstance(context)) .collect(toList()); filters.addAll(getDefaults().getRequestFilters(path)); return filters; }  @Override List<MediaType> getAcceptableWriterMediaTypes(Class<?> type, Type genericType, Annotation[] annotations); @Override ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType); @Override ExceptionMapper<T> getExceptionMapper(Class<T> type); @Override MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override List<MethodInvokerFilter> getMethodInvokerFilters(String path); @Override List<RequestFilter> getRequestFilters(String path); @Override List<ResponseFilter> getResponseFilters(String path);  }
@Test public void retrievesRequestFiltersByPath() { RequestFilter embeddedRequestFilter = mock(RequestFilter.class); when(embeddedProviders.getRequestFilters("/a")).thenReturn(newArrayList(embeddedRequestFilter)); PathMatchesRequestFilter pathMatchesRequestFilter = new PathMatchesRequestFilter(); AllMatchesRequestFilter allMatchesRequestFilter = new AllMatchesRequestFilter(); applicationProviders.addRequestFilter(pathMatchesRequestFilter); applicationProviders.addRequestFilter(allMatchesRequestFilter); assertEquals(newArrayList(allMatchesRequestFilter, embeddedRequestFilter), applicationProviders.getRequestFilters("/a")); }