LinkHeaderResponseFilter implements ContainerResponseFilter { protected UriBuilder addUnchangingQueryParams(UriBuilder builder, MultivaluedMap<String, String> params) { if (params != null) { for (Entry<String, List<String>> e : params.entrySet()) { if (!e.getKey().equals(PageRequest.PAGE_PARAM)) { for (String v : e.getValue()) { builder = builder.queryParam(e.getKey(), v); } } } } return builder; } @Inject  LinkHeaderResponseFilter(Configuration config,
        @Named("PREFIX_APIURL_KEY") String apiUrlPrefixKey); @SuppressWarnings("rawtypes") void filter(ContainerRequestContext reqContext, ContainerResponseContext respContext); static final int MAX_LINK_LENGTH; static final String LINK_HEADER; static final String TOTAL_RECORDS_COUNT; static final String LINK_TYPE; }
@Test public void testAddsUnchangingQueryParameters() { MultivaluedMap<String, String> map = new MultivaluedMapImpl<>(); map.add("baz", "qu=ux"); UriBuilder bu = UriBuilder.fromUri("https: URI returned = interceptor.addUnchangingQueryParams(bu, map).build(); assertEquals(URI.create("https: }
@Test public void testDoesNotAddChangingQueryParameters() { MultivaluedMap<String, String> map = new MultivaluedMapImpl<>(); map.add("page", "10"); UriBuilder bu = UriBuilder.fromUri("https: URI returned = interceptor.addUnchangingQueryParams(bu, map).build(); assertEquals(URI.create("https: }
@Test public void testDoesNotAddAnythingWhenNoQueryParameters() { UriBuilder bu = UriBuilder.fromUri("https: URI returned = interceptor.addUnchangingQueryParams(bu, null).build(); assertEquals(URI.create("https: }