Save This Page
Home » struts-1.3.9-src » org.apache.struts » actions » [javadoc | source]
org.apache.struts.actions
abstract public class: DownloadAction [javadoc | source]
java.lang.Object
   org.apache.struts.action.Action
      org.apache.struts.actions.DownloadAction
This is an abstract base class that minimizes the amount of special coding that needs to be written to download a file. All that is required to use this class is to extend it and implement the getStreamInfo() method so that it returns the relevant information for the file (or other stream) to be downloaded. Optionally, the getBufferSize() method may be overridden to customize the size of the buffer used to transfer the file.
Nested Class Summary:
public static interface  DownloadAction.StreamInfo  The information on a file, or other stream, to be downloaded by the DownloadAction
public static class  DownloadAction.FileStreamInfo  A concrete implementation of the StreamInfo interface which simplifies the downloading of a file from the disk. 
public static class  DownloadAction.ResourceStreamInfo  A concrete implementation of the StreamInfo interface which simplifies the downloading of a web application resource. 
Field Summary
protected static final  int DEFAULT_BUFFER_SIZE    If the getBufferSize() method is not overridden, this is the buffer size that will be used to transfer the data to the servlet output stream. 
Method from org.apache.struts.actions.DownloadAction Summary:
copy,   execute,   getBufferSize,   getStreamInfo
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts.actions.DownloadAction Detail:
 public int copy(InputStream input,
    OutputStream output) throws IOException 
    Copy bytes from an InputStream to an OutputStream.
 public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws Exception 
    Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed.
 protected int getBufferSize() 
    Returns the size of the buffer to be used in transferring the data to the servlet output stream. This method may be overridden by an extending class in order to customize the buffer size.
 abstract protected DownloadAction.StreamInfo getStreamInfo(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws Exception
    Returns the information on the file, or other stream, to be downloaded by this action. This method must be implemented by an extending class.