User user = getUser(request);
Authorizations authorizations = getAuthorizations(request, user);
String graphVertexId = UrlUtils.urlDecode(getAttributeString(request, "graphVertexId"));
Vertex artifactVertex = graph.getVertex(graphVertexId, authorizations);
if (artifactVertex == null) {
respondWithNotFound(response);
return;
}
String fileName = LumifyProperties.FILE_NAME.getPropertyValue(artifactVertex);
if (fileName == null) {
fileName = LumifyProperties.TITLE.getPropertyValue(artifactVertex);
}
if (playback) {
handlePartialPlayback(request, response, artifactVertex, fileName, user);
} else {
String mimeType = getMimeType(artifactVertex);
response.setContentType(mimeType);
setMaxAge(response, EXPIRES_1_HOUR);
if (download) {
response.addHeader("Content-Disposition", "attachment; filename=" + fileName);
} else {
response.addHeader("Content-Disposition", "inline; filename=" + fileName);
}
StreamingPropertyValue rawValue = LumifyProperties.RAW.getPropertyValue(artifactVertex);
if (rawValue == null) {
LOGGER.warn("Could not find raw on artifact: %s", artifactVertex.getId());
respondWithNotFound(response);
return;
}
InputStream in = rawValue.getInputStream();
try {