public void filter(ContainerRequestContext request, ContainerResponseContext response) { final Object entity = response.getEntity(); if (entity != null && !uriInfo.getMatchedResources().isEmpty()) { Class<?> entityClass = entity.getClass(); HeaderProcessor lhp = new HeaderProcessor(entityClass); lhp.processLinkHeaders(entity, uriInfo, response.getHeaders()); FieldProcessor lp = new FieldProcessor(entityClass); lp.processLinks(entity, uriInfo); } }
List<String> getLinkHeaderValues(Object entity, UriInfo uriInfo) { final List<Object> matchedResources = uriInfo.getMatchedResources(); if (!matchedResources.isEmpty()) { final Object resource = matchedResources.get(0); final List<String> headerValues = new ArrayList<String>(); for (LinkHeaderDescriptor desc : instanceDescriptor.getLinkHeaders()) { if (ELLinkBuilder.evaluateCondition(desc.getCondition(), entity, resource, entity)) { String headerValue = getLinkHeaderValue(desc, entity, resource, uriInfo); headerValues.add(headerValue); } } return headerValues; } return Collections.emptyList(); }