}
elem.fireStartedEventIfFirstTime();
RepositoryItem repositoryItem = elem.getRepositoryItem();
RepositoryItemAttributes attributes = repositoryItem.getAttributes();
if (debug > 0) {
if (serveContent) {
log("Serving resource with sessionId '"
+ sessionId
+ "' headers and data. This resource corresponds to repository item '"
+ repositoryItem.getId() + "'");
} else {
log("Serving resource with sessionId '"
+ sessionId
+ "' headers only. This resource corresponds to repository item '"
+ repositoryItem.getId() + "'");
}
}
boolean malformedRequest = response.getStatus() >= SC_BAD_REQUEST;
if (!malformedRequest && !checkIfHeaders(request, response, attributes)) {
return;
}
String contentType = getContentType(elem, attributes);
List<Range> ranges = null;
if (!malformedRequest) {
response.setHeader("Accept-Ranges", "bytes");
response.setHeader("ETag", attributes.getETag());
response.setHeader("Last-Modified",
attributes.getLastModifiedHttp());
ranges = parseRange(request, response, attributes);
}
long contentLength = attributes.getContentLength();
// Special case for zero length files, which would cause a
// (silent) ISE when setting the output buffer size
if (contentLength == 0L) {
serveContent = false;