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 |
NXBIGFILE
Deprecated.
since 7.4, use nxfile instead
|
static String |
NXBIGZIPFILE
Deprecated.
since 9.1, use nxbigblob instead
|
static String |
NXBLOBSTATUS |
static String |
NXDOWNLOADINFO |
static String |
NXFILE |
static String |
TRANSIENT_STORE_PARAM_ERROR
The transient store parameter name for storing an error if any.
|
static String |
TRANSIENT_STORE_PARAM_PROGRESS |
static String |
TRANSIENT_STORE_STORE_NAME |
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)
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.
|
void |
downloadBlob(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String storeKey,
String reason)
Triggers a blobs download.
|
void |
downloadBlobStatus(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String storeKey,
String reason)
Deprecated.
since 10.3, use the @async operation adapter instead.
|
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 storeKey)
Gets the URL to use to download the blobs identified by a storage key.
|
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.
|
String |
getDownloadUrl(String repositoryName,
String docId,
String xpath,
String filename,
String changeToken)
Gets the URL to use to download the blob at the given xpath in the given document.
|
void |
handleDownload(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String baseUrl,
String path)
Handles the download of a document.
|
void |
logDownload(DocumentModel doc,
String blobXPath,
String filename,
String reason,
Map<String,Serializable> extendedInfos)
Logs a download.
|
Blob |
resolveBlob(DocumentModel doc)
Finds a document's blob.
|
Blob |
resolveBlob(DocumentModel doc,
String xpath)
Finds a document's blob given an xpath or blobholder index
|
Blob |
resolveBlobFromDownloadUrl(String downloadURL)
Finds a document's blob given the download URL returned by
getDownloadUrl(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, java.lang.String) . |
String |
storeBlobs(List<Blob> blobs)
Stores the blobs for later download.
|
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 NXBLOBSTATUS
static final String NXBIGBLOB
@Deprecated static final String NXBIGZIPFILE
@Deprecated static final String NXBIGFILE
static final String BLOBHOLDER_PREFIX
static final String BLOBHOLDER_0
static final String TRANSIENT_STORE_PARAM_ERROR
static final String TRANSIENT_STORE_PARAM_PROGRESS
static final String TRANSIENT_STORE_STORE_NAME
String storeBlobs(List<Blob> blobs)
the
- list of blobs to storegetDownloadUrl(String)
String getDownloadUrl(DocumentModel doc, String xpath, String filename)
The URL is relative to the Nuxeo Web Application context.
Returns something like nxfile/reponame/docuuid/blobholder:0/foo.jpg?changeToken=5-1
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, String changeToken)
The URL is relative to the Nuxeo Web Application context.
Returns something like nxfile/reponame/docuuid/blobholder:0/foo.jpg?changeToken=5-1
doc
- the documentxpath
- the blob's xpath or blobholder index, or null
for defaultfilename
- the blob's filename, or null
for defaultchangeToken
- the doc changeToken which will be appended as a query parameter for optimized http caching.String getDownloadUrl(String repositoryName, String docId, String xpath, String filename)
The URL is relative to the Nuxeo Web Application context.
Returns something like nxfile/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 defaultString getDownloadUrl(String storeKey)
The URL is relative to the Nuxeo Web Application context.
Returns something like nxbigblob/key
key
- The key of stored blobs to downloadBlob resolveBlobFromDownloadUrl(String downloadURL)
getDownloadUrl(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, java.lang.String)
.
The permissions are check whether the user can download the blob or not.
downloadURL
- the URL to use to download the blobnull
if not found or if the user has no permission to download itvoid handleDownload(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String baseUrl, String path) throws IOException
req
- the requestresp
- the responsebaseUrl
- the request baseUrlpath
- the request path, without the contextIOException
@Deprecated void downloadBlobStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String storeKey, String reason) throws IOException
AsyncBlob
download which gives information about an asynchronous blob.storeKey
- the stored blobs keyreason
- the download reasonIOException
void downloadBlob(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String storeKey, String reason) throws IOException
storeKey
- the stored blobs keyreason
- 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) 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) 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 loginline
- if not null, force the inline flag for content-dispositionIOException
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 foundBlob resolveBlob(DocumentModel doc)
doc
- the documentnull
if not availableboolean 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 © 2019 Nuxeo. All rights reserved.