public static class BinaryFileServlet.DownloadTicket
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
DownloadTicket(java.io.File file)
Builds a new download ticket for the specified file.
|
DownloadTicket(java.io.File file,
java.lang.String contentType)
Builds a new download ticket for the specified file.
|
DownloadTicket(java.io.File file,
java.lang.String contentType,
java.lang.String filename)
Builds a new download ticket for the specified file.
|
Modifier and Type | Method and Description |
---|---|
void |
sendToDownloadUrl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Redirect current request to the download URL of the file specified by this ticket.
|
void |
setContentType(java.lang.String contentType)
Set the content type to use for this download.
|
void |
setDeleteFileAfterDelivery(boolean deleteFileAfterDelivery)
Set whether the file should be deleted after the delivery to the client.
|
void |
setFilename(java.lang.String filename)
Set the filename to be displayed in the browser (content disposition/attachement)
|
void |
setUsePragmaNoCache(boolean usePragmaNoCache)
Set whether to use HTTP header "Pragma", "no-cache".
|
java.lang.String |
toString() |
public DownloadTicket(java.io.File file)
file
- the file to send required.public DownloadTicket(java.io.File file, java.lang.String contentType)
file
- the file to send required.contentType
- the content type to use (default is application/octet-stream
)public DownloadTicket(java.io.File file, java.lang.String contentType, java.lang.String filename)
file
- the file to send. required.contentType
- the content type to use (default is application/octet-stream
)filename
- the filename to be displayed in the browser (content disposition/attachement), use alphanumeric or dash, do not use special characters.public void setContentType(java.lang.String contentType)
Default is application/octet-stream
.
contentType
- a content type such as "image/jpeg"public void setFilename(java.lang.String filename)
Default value is null (no filename is sent to browser).
filename
- a filename such as my-file.csv
, use alphanumeric or dash, do not use special characters. or null to skip.public void setUsePragmaNoCache(boolean usePragmaNoCache)
Default is false
.
usePragmaNoCache
- true to use pragma/nocache header, false otherwise.public void setDeleteFileAfterDelivery(boolean deleteFileAfterDelivery)
Default is false
.
deleteFileAfterDelivery
- true to delete file after delivery, false to leave file as is.public void sendToDownloadUrl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
request
- current HttpServletRequestresponse
- the response in which to write redirect headersjava.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001-2017 Jalios SA. All Rights Reserved.