final PageableQueryValidator validator = new PageableQueryValidator(context, queryName, uriInfo);
if (validator.isFeatureApplicable()) {
// Do pagination
query.setFirstResult(validator.getOffset());
query.setMaxResults(validator.getLimit());
return namedQueryResponse(context, queryName, dbQuery, query, headers, uriInfo, new PagingResponseBuilder());
} else {
// No pagination
return namedQueryResponse(context, queryName, dbQuery, query, headers, uriInfo, new SelfLinksResponseBuilder());
}
}