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 Blobblobprotected Consumer<ByteRange>blobTransfererprotected DocumentModeldocprotected Map<String,Serializable>extendedInfosprotected Stringfilenameprotected Booleaninlineprotected CalendarlastModifiedprotected Stringreasonprotected javax.servlet.http.HttpServletRequestrequestprotected javax.servlet.http.HttpServletResponseresponseprotected Stringxpath
-
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.Builderblob(Blob blob)The blob, if already fetched.DownloadService.DownloadContext.BuilderblobTransferer(Consumer<ByteRange> blobTransferer)The consumer sending the blob's bytes to a client for a given byte range.DownloadService.DownloadContextbuild()Builds a finalDownloadService.DownloadContext.DownloadService.DownloadContext.Builderdoc(DocumentModel doc)The document from which to download the blob.DownloadService.DownloadContext.BuilderextendedInfos(Map<String,Serializable> extendedInfos)The extended infos, holding additional info about the download (in particular for logging and permission checks).DownloadService.DownloadContext.Builderfilename(String filename)The filename to use.DownloadService.DownloadContext.Builderinline(Boolean inline)Iftrue, specifiesContent-Disposition: inline, and iffalseusesContent-Disposition: attachment.DownloadService.DownloadContext.BuilderlastModified(Calendar lastModified)The last modified date of the blob.DownloadService.DownloadContext.Builderreason(String reason)The download reason.DownloadService.DownloadContext.Builderxpath(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 therenditionkey.
-
inline
public DownloadService.DownloadContext.Builder inline(Boolean inline)
Iftrue, specifiesContent-Disposition: inline, and iffalseusesContent-Disposition: attachment.If
null, a request parameterinlinewill be checked instead.By default,
Content-Disposition: inlinewill 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.
-
-