if (!ResourceUtils.hasChanged(request, resource, language)) {
return Response.notModified().build();
}
// Load the content
ResourceContent resourceContent = resource.getContent(language);
if (resourceContent == null) {
throw new WebApplicationException(Status.NOT_FOUND);
}
// If the content is hosted externally, send a redirect and be done with it
if (resourceContent.getExternalLocation() != null) {
try {
return Response.temporaryRedirect(resourceContent.getExternalLocation().toURI()).build();
} catch (URISyntaxException e) {
throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
}
}