/** * Adds the specified link to the headers and to the map of links that will be added to the body of the response. * * @param link The type of the link being added * @param pageNumber The page being linked to * @param perPage The number of result rows in the page being linked to * @param uriBuilder The uri builder to build the links * @param responseProcessor The response processor whose links are being built * @param bodyLinks The map of links that will be added to the body of the response */ public static void addLink( PaginationLink link, int pageNumber, int perPage, UriBuilder uriBuilder, MappingResponseProcessor responseProcessor, Map<String, URI> bodyLinks ) { UriBuilder pageLink = uriBuilder.replaceQueryParam(PAGE, pageNumber).replaceQueryParam(PER_PAGE, perPage); responseProcessor.getHeaders().add( HttpHeaders.LINK, Link.fromUriBuilder(pageLink).rel(link.getHeaderName()).build().toString() ); bodyLinks.put(link.getBodyName(), pageLink.build()); }
mappingResponse.getMappers().add(0, mapper); mappingResponse.getHeaders().add(PARTIAL_DATA_HEADER, true); responseContext.put(PARTIAL_DATA_HEADER, true);