log.error("Failed to create file: {}", fileName);
}
ResponseBuilder response = Response.ok((Object) file);
response.header("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
response.type("text/plain");
addCORSOrigin(servletContext, response, headers);
return response.build();
} else if (type.equals("raw")) {
//TODO we should return the content directly without the file indirection
String fileName = URLEncoder.encode(contentURI, "utf-8") + "-raw";