public Response retrieveAllPrograms(@Context HttpHeaders headers) {
MediaType acceptedHeader = RestUtil.getAcceptedMediaType(headers, MediaType.APPLICATION_JSON_TYPE);
if (acceptedHeader.isCompatible(MediaType.TEXT_HTML_TYPE)) {
return Response.ok(new Viewable("index", this), MediaType.TEXT_HTML).build();
} else {
LDProgramCollection ldProgramCollection = programManager.retrieveAllPrograms();
ResponseBuilder rb = Response.ok(ldProgramCollection, MediaType.APPLICATION_JSON);
addCORSOrigin(servletContext, rb, headers);
return rb.build();
}
}