Package org.nuxeo.ecm.core.io.download
Class DownloadService.DownloadContext.Builder
- java.lang.Object
-
- org.nuxeo.ecm.core.io.download.DownloadService.DownloadContext.Builder
-
- Enclosing class:
- DownloadService.DownloadContext
public static class DownloadService.DownloadContext.Builder extends Object
Builder for aDownloadService.DownloadContext
.- Since:
- 11.1
-
-
Field Summary
Fields Modifier and Type Field Description protected Blob
blob
protected Consumer<ByteRange>
blobTransferer
protected DocumentModel
doc
protected Map<String,Serializable>
extendedInfos
protected String
filename
protected Boolean
inline
protected Calendar
lastModified
protected String
reason
protected javax.servlet.http.HttpServletRequest
request
protected javax.servlet.http.HttpServletResponse
response
protected String
xpath
-
Constructor Summary
Constructors Constructor Description Builder(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DownloadService.DownloadContext.Builder
blob(Blob blob)
The blob, if already fetched.DownloadService.DownloadContext.Builder
blobTransferer(Consumer<ByteRange> blobTransferer)
The consumer sending the blob's bytes to a client for a given byte range.DownloadService.DownloadContext
build()
Builds a finalDownloadService.DownloadContext
.DownloadService.DownloadContext.Builder
doc(DocumentModel doc)
The document from which to download the blob.DownloadService.DownloadContext.Builder
extendedInfos(Map<String,Serializable> extendedInfos)
The extended infos, holding additional info about the download (in particular for logging and permission checks).DownloadService.DownloadContext.Builder
filename(String filename)
The filename to use.DownloadService.DownloadContext.Builder
inline(Boolean inline)
Iftrue
, specifiesContent-Disposition: inline
, and iffalse
usesContent-Disposition: attachment
.DownloadService.DownloadContext.Builder
lastModified(Calendar lastModified)
The last modified date of the blob.DownloadService.DownloadContext.Builder
reason(String reason)
The download reason.DownloadService.DownloadContext.Builder
xpath(String xpath)
The blob's xpath in the document, or the blobholder index.
-
-
-
Field Detail
-
request
protected final javax.servlet.http.HttpServletRequest request
-
response
protected final javax.servlet.http.HttpServletResponse response
-
doc
protected DocumentModel doc
-
xpath
protected String xpath
-
blob
protected Blob blob
-
filename
protected String filename
-
reason
protected String reason
-
extendedInfos
protected Map<String,Serializable> extendedInfos
-
inline
protected Boolean inline
-
lastModified
protected Calendar lastModified
-
-
Method Detail
-
doc
public DownloadService.DownloadContext.Builder doc(DocumentModel doc)
The document from which to download the blob.
-
xpath
public DownloadService.DownloadContext.Builder xpath(String xpath)
The blob's xpath in the document, or the blobholder index.
-
blob
public DownloadService.DownloadContext.Builder blob(Blob blob)
The blob, if already fetched. Otherwise, it will be retrieved from the document and the xpath.
-
filename
public DownloadService.DownloadContext.Builder filename(String filename)
The filename to use. If absent, the blob's filename will be used.
-
reason
public DownloadService.DownloadContext.Builder reason(String reason)
The download reason.The request attribute
DownloadService.REQUEST_ATTR_DOWNLOAD_REASON
, if present, will be used instead.
-
extendedInfos
public DownloadService.DownloadContext.Builder extendedInfos(Map<String,Serializable> extendedInfos)
The extended infos, holding additional info about the download (in particular for logging and permission checks).The request attribute
DownloadService.REQUEST_ATTR_DOWNLOAD_RENDITION
, if present, will be used for therendition
key.
-
inline
public DownloadService.DownloadContext.Builder inline(Boolean inline)
Iftrue
, specifiesContent-Disposition: inline
, and iffalse
usesContent-Disposition: attachment
.If
null
, a request parameterinline
will be checked instead.By default,
Content-Disposition: inline
will be used.
-
blobTransferer
public DownloadService.DownloadContext.Builder blobTransferer(Consumer<ByteRange> blobTransferer)
The consumer sending the blob's bytes to a client for a given byte range.The default is just to send to the response output stream, without buffering.
-
lastModified
public DownloadService.DownloadContext.Builder lastModified(Calendar lastModified)
The last modified date of the blob.
-
build
public DownloadService.DownloadContext build()
Builds a finalDownloadService.DownloadContext
.
-
-