}
Boolean collectionContainsDomainObjects = collectionContainsDomainObjects(entity);
if (collectionContainsDomainObjects != null) {
if (collectionContainsDomainObjects.booleanValue()) {
return Response.ok(new StreamingOutputMarshaller(app, entity, hh.getAcceptableMediaTypes())).build();
} else {
// Classes derived from PersistenceWeavedRest class are already in the JAXB context and marshalled properly.
// Here, we will only need to deal with collection of classes that are not in the JAXB context, such as String, Integer...
//
// Jersey 1.2 introduced a new api JResponse to support this better, but in order to be able to work with
// older versions of Jersey, we will use our own wrapper.
return Response.ok(new StreamingOutputMarshaller(app, populateSimpleHomogeneousList((Collection) entity, attribute), hh.getAcceptableMediaTypes())).build();
}
}
return Response.ok(new StreamingOutputMarshaller(app, entity, hh.getAcceptableMediaTypes())).build();
}