resource = versionedFile.getVersionHistory().getVersion(version);
istream = ((VersionResource)resource).getContentAsStream();
}
else
{
resource = new FileResource(uri, node, nsContext);
istream = ((FileResource)resource).getContentAsStream();
}
HierarchicalProperty contentLengthProperty = resource.getProperty(FileResource.GETCONTENTLENGTH);
long contentLength = new Long(contentLengthProperty.getValue());
HierarchicalProperty mimeTypeProperty = resource.getProperty(FileResource.GETCONTENTTYPE);
String contentType = mimeTypeProperty.getValue();
FileResource fileResource = new FileResource(uri, node, nsContext);
HierarchicalProperty lastModifiedProperty = fileResource.getProperty(FileResource.GETLASTMODIFIED);
// content length is not present
if (contentLength == 0)
{
return Response.ok().header(ExtHttpHeaders.ACCEPT_RANGES, "bytes").entity(istream).build();