org.apache.struts.actions
Class DownloadAction.ResourceStreamInfo

java.lang.Object
  extended by org.apache.struts.actions.DownloadAction.ResourceStreamInfo
All Implemented Interfaces:
DownloadAction.StreamInfo
Enclosing class:
DownloadAction

public static class DownloadAction.ResourceStreamInfo
extends Object
implements DownloadAction.StreamInfo

A concrete implementation of the StreamInfo interface which simplifies the downloading of a web application resource.


Constructor Summary
DownloadAction.ResourceStreamInfo(String contentType, ServletContext context, String path)
          Constructs an instance of this class, based on the supplied parameters.
 
Method Summary
 String getContentType()
          Returns the content type of the stream to be downloaded.
 InputStream getInputStream()
          Returns an input stream on the resource to be downloaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadAction.ResourceStreamInfo

public DownloadAction.ResourceStreamInfo(String contentType,
                                         ServletContext context,
                                         String path)
Constructs an instance of this class, based on the supplied parameters.

Parameters:
contentType - The content type of the file.
context - The servlet context for the resource.
path - The path to the resource to be downloaded.
Method Detail

getContentType

public String getContentType()
Returns the content type of the stream to be downloaded.

Specified by:
getContentType in interface DownloadAction.StreamInfo
Returns:
The content type of the stream.

getInputStream

public InputStream getInputStream()
                           throws IOException
Returns an input stream on the resource to be downloaded. This stream will be closed by the DownloadAction.

Specified by:
getInputStream in interface DownloadAction.StreamInfo
Returns:
The input stream for the resource to be downloaded.
Throws:
IOException - if an error occurs


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.