// next link
// The uri might have other query/matrix parameters, just replace the limit and offset
// for next and prev links and leave the rest untouched
uriBuilder = UriBuilder.fromUri(uriInfo.getRequestUri());
uriBuilder.replaceQueryParam(QueryParameters.JPARS_PAGING_OFFSET, nextOffset);
links.add(new LinkV2(ReservedWords.JPARS_REL_NEXT, uriBuilder.build().toString()));
resultCollection.setHasMore(true);
} else {
resultCollection.setHasMore(false);
}
}
if (!NO_PREVIOUS_CHUNK.equals(prevOffset)) {
// prev link
uriBuilder = UriBuilder.fromUri(uriInfo.getRequestUri());
uriBuilder.replaceQueryParam(QueryParameters.JPARS_PAGING_OFFSET, prevOffset);
links.add(new LinkV2(ReservedWords.JPARS_REL_PREV, uriBuilder.build().toString()));
}
links.add(new LinkV2(ReservedWords.JPARS_REL_SELF, uriInfo.getRequestUri().toString()));
resultCollection.setLinks(links);
resultCollection.setOffset(offset);
resultCollection.setLimit(limit);