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 |
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)
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.
|
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.
|
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,
String xpath)
Finds a document's blob given an xpath or blobholder index
|
Blob |
resolveBlobFromDownloadUrl(String url)
Finds a document's blob given the URL to use to download the blob.
|
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 NXBIGBLOB
@Deprecated static final String NXBIGZIPFILE
@Deprecated static final String NXBIGFILE
static final String BLOBHOLDER_PREFIX
static final String BLOBHOLDER_0
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 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 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 url)
url
- the URL to use to download the blobnull
if not foundvoid 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
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 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 © 2017 Nuxeo. All rights reserved.