org.apache.struts.actions
Class DownloadAction.ResourceStreamInfo

java.lang.Object
  |
  +--org.apache.struts.actions.DownloadAction.ResourceStreamInfo
All Implemented Interfaces:
DownloadAction.StreamInfo
Enclosing class:
DownloadAction

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

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


Field Summary
private  java.lang.String contentType
          The content type for this stream.
private  javax.servlet.ServletContext context
          The servlet context for the resource to be downloaded.
private  java.lang.String path
          The path to the resource to be downloaded.
 
Constructor Summary
DownloadAction.ResourceStreamInfo(java.lang.String contentType, javax.servlet.ServletContext context, java.lang.String path)
          Constructs an instance of this class, based on the supplied parameters.
 
Method Summary
 java.lang.String getContentType()
          Returns the content type of the stream to be downloaded.
 java.io.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, registerNatives, toString, wait, wait, wait
 

Field Detail

contentType

private java.lang.String contentType
The content type for this stream.

context

private javax.servlet.ServletContext context
The servlet context for the resource to be downloaded.

path

private java.lang.String path
The path to the resource to be downloaded.
Constructor Detail

DownloadAction.ResourceStreamInfo

public DownloadAction.ResourceStreamInfo(java.lang.String contentType,
                                         javax.servlet.ServletContext context,
                                         java.lang.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 java.lang.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 java.io.InputStream getInputStream()
                                   throws java.io.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.


Copyright 2000-2006 - The Apache Software Foundation