com.jalios.jcms.servlet
Class BinaryFileServlet.DownloadTicket

java.lang.Object
  extended by com.jalios.jcms.servlet.BinaryFileServlet.DownloadTicket
All Implemented Interfaces:
Serializable
Enclosing class:
BinaryFileServlet

public static class BinaryFileServlet.DownloadTicket
extends Object
implements Serializable

See Also:
Serialized Form

Constructor Summary
BinaryFileServlet.DownloadTicket(File file)
          Builds a new download ticket for the specified file.
BinaryFileServlet.DownloadTicket(File file, String contentType)
          Builds a new download ticket for the specified file.
BinaryFileServlet.DownloadTicket(File file, String contentType, String filename)
          Builds a new download ticket for the specified file.
 
Method Summary
 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(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(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".
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryFileServlet.DownloadTicket

public BinaryFileServlet.DownloadTicket(File file)
Builds a new download ticket for the specified file.

Parameters:
file - the file to send required.

BinaryFileServlet.DownloadTicket

public BinaryFileServlet.DownloadTicket(File file,
                                        String contentType)
Builds a new download ticket for the specified file.

Parameters:
file - the file to send required.
contentType - the content type to use (default is application/octet-stream)

BinaryFileServlet.DownloadTicket

public BinaryFileServlet.DownloadTicket(File file,
                                        String contentType,
                                        String filename)
Builds a new download ticket for the specified file.

Parameters:
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.
Method Detail

setContentType

public void setContentType(String contentType)
Set the content type to use for this download.

Default is application/octet-stream.

Parameters:
contentType - a content type such as "image/jpeg"

setFilename

public void setFilename(String filename)
Set the filename to be displayed in the browser (content disposition/attachement)

Default value is null (no filename is sent to browser).

Parameters:
filename - a filename such as my-file.csv, use alphanumeric or dash, do not use special characters. or null to skip.

setUsePragmaNoCache

public void setUsePragmaNoCache(boolean usePragmaNoCache)
Set whether to use HTTP header "Pragma", "no-cache".

Default is false.

Parameters:
usePragmaNoCache - true to use pragma/nocache header, false otherwise.

setDeleteFileAfterDelivery

public void setDeleteFileAfterDelivery(boolean deleteFileAfterDelivery)
Set whether the file should be deleted after the delivery to the client.

Default is false.

Parameters:
deleteFileAfterDelivery - true to delete file after delivery, false to leave file as is.

sendToDownloadUrl

public void sendToDownloadUrl(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws IOException
Redirect current request to the download URL of the file specified by this ticket.

Parameters:
request - current HttpServletRequest
response - the response in which to write redirect headers
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2010 Jalios SA. All Rights Reserved.