com.quadrique.jbuildingblocks.core.servlet
Class JbbFileDownload

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.servlet.JbbFileDownload

public class JbbFileDownload
extends Object

Use this class to download a static or dynamically generated file on the server to the client.

Author:
Hervé Rivere

Constructor Summary
JbbFileDownload()
           
 
Method Summary
static void downloadExcelFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a Microsoft Excel file (.xls) from a HTTP server to a client's machine.
static void downloadFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a file from a HTTP server to a client's machine.
static void downloadFlashFileToClient(File fileToDownload, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a .swf file from a HTTP server to a client's machine.
static void downloadJpegFileToClient(File fileToDownload, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a jpeg file from a HTTP server to a client's machine.
static void downloadJpegImageToClient(byte[] bytes, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a jpeg image from a HTTP server to a client's machine.
static void downloadPdfFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a PDF file (.pdf) from a HTTP server to a client's machine.
static void downloadPdfFileToClientInline(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a PDF file (.pdf) from a HTTP server to a client's machine.
static void downloadPowerPointFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a Microsoft powerpoint file (.ppt) from a HTTP server to a client's machine.
static void downloadQuickTimeFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a Quick Time movie file (.mov) from a HTTP server to a client's machine.
static void downloadWordFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a Microsoft Word file (.doc) from a HTTP server to a client's machine.
static void downloadXmlFileToClient(File fileToDownload, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download an xml file from a HTTP server to a client's machine.
static void downloadZipFileToClient(File fileToDownload, String nameOfTheDownloadedFile, javax.servlet.http.HttpServletResponse response)
          This method is a convenience method to download a .zip file from a HTTP server to a client's machine.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbbFileDownload

public JbbFileDownload()
Method Detail

downloadExcelFileToClient

public static void downloadExcelFileToClient(File fileToDownload,
                                             String nameOfTheDownloadedFile,
                                             javax.servlet.http.HttpServletResponse response)
                                      throws Exception
This method is a convenience method to download a Microsoft Excel file (.xls) from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.xls")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_spreadsheet.xls")
response -
Throws:
Exception

downloadPdfFileToClient

public static void downloadPdfFileToClient(File fileToDownload,
                                           String nameOfTheDownloadedFile,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws Exception
This method is a convenience method to download a PDF file (.pdf) from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.pdf")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.pdf")
response -
Throws:
Exception

downloadPowerPointFileToClient

public static void downloadPowerPointFileToClient(File fileToDownload,
                                                  String nameOfTheDownloadedFile,
                                                  javax.servlet.http.HttpServletResponse response)
                                           throws Exception
This method is a convenience method to download a Microsoft powerpoint file (.ppt) from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.ppt")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.ppt")
response -
Throws:
Exception

downloadWordFileToClient

public static void downloadWordFileToClient(File fileToDownload,
                                            String nameOfTheDownloadedFile,
                                            javax.servlet.http.HttpServletResponse response)
                                     throws Exception
This method is a convenience method to download a Microsoft Word file (.doc) from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.doc")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.doc")
response -
Throws:
Exception

downloadZipFileToClient

public static void downloadZipFileToClient(File fileToDownload,
                                           String nameOfTheDownloadedFile,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws Exception
This method is a convenience method to download a .zip file from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.zip")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.zip")
response -
Throws:
Exception

downloadFileToClient

public static void downloadFileToClient(File fileToDownload,
                                        String nameOfTheDownloadedFile,
                                        javax.servlet.http.HttpServletResponse response)
                                 throws Exception
This method is a convenience method to download a file from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.bin")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.bin")
response -
Throws:
Exception

downloadFlashFileToClient

public static void downloadFlashFileToClient(File fileToDownload,
                                             javax.servlet.http.HttpServletResponse response)
                                      throws Exception
This method is a convenience method to download a .swf file from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.swf")
response -
Throws:
Exception

downloadXmlFileToClient

public static void downloadXmlFileToClient(File fileToDownload,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws Exception
This method is a convenience method to download an xml file from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.xml")
response -
Throws:
Exception

downloadJpegFileToClient

public static void downloadJpegFileToClient(File fileToDownload,
                                            javax.servlet.http.HttpServletResponse response)
                                     throws Exception
This method is a convenience method to download a jpeg file from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.jpg")
response -
Throws:
Exception

downloadQuickTimeFileToClient

public static void downloadQuickTimeFileToClient(File fileToDownload,
                                                 String nameOfTheDownloadedFile,
                                                 javax.servlet.http.HttpServletResponse response)
                                          throws Exception
This method is a convenience method to download a Quick Time movie file (.mov) from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.mov")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.mov")
response -
Throws:
Exception

downloadPdfFileToClientInline

public static void downloadPdfFileToClientInline(File fileToDownload,
                                                 String nameOfTheDownloadedFile,
                                                 javax.servlet.http.HttpServletResponse response)
                                          throws Exception
This method is a convenience method to download a PDF file (.pdf) from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
fileToDownload - the file to download (e.g. "/tmp/data.pdf")
nameOfTheDownloadedFile - the name of the downloaded file on the client's machine (e.g. "your_document.pdf")
response -
Throws:
Exception

downloadJpegImageToClient

public static void downloadJpegImageToClient(byte[] bytes,
                                             javax.servlet.http.HttpServletResponse response)
                                      throws Exception
This method is a convenience method to download a jpeg image from a HTTP server to a client's machine. It handles all the HTTP headers setup as well as the streaming of the file content on the socket. Please note that the given file is not deleted once the method has completed its execution.

Parameters:
bytes - the bytes corresponding to the image
response -
Throws:
Exception


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.