public interface DownloadService
Modifier and Type | Interface and Description |
---|---|
static class |
DownloadService.ByteRange |
Modifier and Type | Field and Description |
---|---|
static String |
BLOBHOLDER_0 |
static String |
BLOBHOLDER_PREFIX |
static String |
EVENT_NAME |
static String |
NXBIGBLOB |
static String |
NXBIGZIPFILE |
static String |
NXDOWNLOADINFO |
static String |
NXFILE |
Modifier and Type | Method and Description |
---|---|
boolean |
checkPermission(DocumentModel doc,
String xpath,
Blob blob,
String reason,
Map<String,Serializable> extendedInfos)
Checks whether the download of the blob is allowed.
|
void |
downloadBlob(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason)
Triggers a blob download.
|
void |
downloadBlob(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason,
Map<String,Serializable> extendedInfos)
Triggers a blob download.
|
void |
downloadBlob(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
DocumentModel doc,
String xpath,
Blob blob,
String filename,
String reason,
Map<String,Serializable> extendedInfos,
Boolean inline,
Consumer<DownloadService.ByteRange> blobTransferer)
Triggers a blob download.
|
String |
getDownloadUrl(DocumentModel doc,
String xpath,
String filename)
Gets the URL to use to download the blob at the given xpath in the given document.
|
String |
getDownloadUrl(String repositoryName,
String docId,
String xpath,
String filename)
Gets the URL to use to download the blob at the given xpath in the given document.
|
void |
logDownload(DocumentModel doc,
String blobXPath,
String filename,
String reason,
Map<String,Serializable> extendedInfos)
Logs a download.
|
Blob |
resolveBlob(DocumentModel doc,
String xpath)
Finds a document's blob given an xpath or blobholder index
|
void |
transferBlobWithByteRange(Blob blob,
DownloadService.ByteRange byteRange,
Supplier<OutputStream> outputStreamSupplier)
Copies the blob stream at the given byte range into the supplied
OutputStream . |
static final String EVENT_NAME
static final String NXFILE
static final String NXDOWNLOADINFO
static final String NXBIGBLOB
static final String NXBIGZIPFILE
static final String BLOBHOLDER_PREFIX
static final String BLOBHOLDER_0
String getDownloadUrl(DocumentModel doc, String xpath, String filename)
The URL is relative to the Nuxeo Web Application context.
Returns something like nxbigfile/reponame/docuuid/blobholder:0/foo.jpg
doc
- the documentxpath
- the blob's xpath or blobholder index, or null
for defaultfilename
- the blob's filename, or null
for defaultString getDownloadUrl(String repositoryName, String docId, String xpath, String filename)
The URL is relative to the Nuxeo Web Application context.
Returns something like nxbigfile/reponame/docuuid/blobholder:0/foo.jpg
repositoryName
- the document repositorydocId
- the document idxpath
- the blob's xpath or blobholder index, or null
for defaultfilename
- the blob's filename, or null
for defaultvoid downloadBlob(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DocumentModel doc, String xpath, Blob blob, String filename, String reason) throws IOException
doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonIOException
void downloadBlob(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DocumentModel doc, String xpath, Blob blob, String filename, String reason, Map<String,Serializable> extendedInfos) throws IOException
doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonextendedInfos
- an optional map of extended informations to logIOException
void downloadBlob(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DocumentModel doc, String xpath, Blob blob, String filename, String reason, Map<String,Serializable> extendedInfos, Boolean inline, Consumer<DownloadService.ByteRange> blobTransferer) throws IOException
DownloadExecutor
.doc
- the document, if availablexpath
- the blob's xpath or blobholder index, if availableblob
- the blob, if already fetchedfilename
- the filename to usereason
- the download reasonextendedInfos
- an optional map of extended informations to loginline
- if not null, force the inline flag for content-dispositionblobTransferer
- the transferer of the actual blobIOException
void transferBlobWithByteRange(Blob blob, DownloadService.ByteRange byteRange, Supplier<OutputStream> outputStreamSupplier)
OutputStream
.blob
- the blobbyteRange
- the byte rangeoutputStreamSupplier
- the OutputStream
suppliervoid logDownload(DocumentModel doc, String blobXPath, String filename, String reason, Map<String,Serializable> extendedInfos)
doc
- the doc for which this download occurs, if availableblobXPath
- the blob's xpath or blobholder index, if availablefilename
- the filenamereason
- the download reasonextendedInfos
- an optional map of extended informations to logBlob resolveBlob(DocumentModel doc, String xpath)
doc
- the documentxpath
- the xpath or blobholder indexnull
if not foundboolean checkPermission(DocumentModel doc, String xpath, Blob blob, String reason, Map<String,Serializable> extendedInfos)
doc
- the doc for which this download occurs, if availableblobXPath
- the blob's xpath or blobholder index, if availableblob
- the blobreason
- the download reasonextendedInfos
- an optional map of extended informations to logtrue
if download is allowedCopyright © 2015 Nuxeo SA. All rights reserved.