| org.apache.struts.actions.BaseAction org.apache.struts.actions.DownloadAction
DownloadAction | abstract public class DownloadAction extends BaseAction (Code) | | 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.
since: Struts 1.2.6 |
Inner Class :public static interface StreamInfo | |
Inner Class :public static class FileStreamInfo implements StreamInfo | |
Inner Class :public static class ResourceStreamInfo implements StreamInfo | |
Field Summary | |
final protected static 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 Summary | |
public int | copy(InputStream input, OutputStream output) Copy bytes from an InputStream to an
OutputStream .
Parameters: input - The InputStream to read from. Parameters: output - The OutputStream to write to. | public ActionForward | execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 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.
Parameters: mapping - The ActionMapping used to select this instance. Parameters: form - The optional ActionForm bean for this request (ifany). Parameters: request - The HTTP request we are processing. Parameters: response - The HTTP response we are creating. | protected int | getBufferSize() Returns the size of the buffer to be used in transferring the data to
the servlet output stream. | abstract protected StreamInfo | getStreamInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) Returns the information on the file, or other stream, to be downloaded
by this action. |
DEFAULT_BUFFER_SIZE | final protected static int DEFAULT_BUFFER_SIZE(Code) | | 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.
|
copy | public int copy(InputStream input, OutputStream output) throws IOException(Code) | | Copy bytes from an InputStream to an
OutputStream .
Parameters: input - The InputStream to read from. Parameters: output - The OutputStream to write to. the number of bytes copied throws: IOException - In case of an I/O problem |
execute | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code) | | 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.
Parameters: mapping - The ActionMapping used to select this instance. Parameters: form - The optional ActionForm bean for this request (ifany). Parameters: request - The HTTP request we are processing. Parameters: response - The HTTP response we are creating. The forward to which control should be transferred, ornull if the response has been completed. throws: Exception - if an exception occurs. |
getBufferSize | protected int getBufferSize()(Code) | | 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.
The size of the transfer buffer, in bytes. |
getStreamInfo | abstract protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception(Code) | | Returns the information on the file, or other stream, to be downloaded
by this action. This method must be implemented by an extending class.
Parameters: mapping - The ActionMapping used to select this instance. Parameters: form - The optional ActionForm bean for this request (ifany). Parameters: request - The HTTP request we are processing. Parameters: response - The HTTP response we are creating. The information for the file to be downloaded. throws: Exception - if an exception occurs. |
|
|