javawebparts.servlet
Interface ResourceStream

All Known Implementing Classes:
ResourceStreamFromFileSystem, ResourceStreamFromJAR, ResourceStreamFromURL

public interface ResourceStream

The ResourceStream interface is implemented by classes used by the ResourceServerServlet. An implementing class' job is to return an InputStream to a resource that the servlet will serve, and also optionally report its content type.

Author:
Frank W. Zammetti.

Method Summary
 java.lang.String getContentType(java.lang.String inRequestedResource, java.lang.String inParam1, java.lang.String inParam2, javax.servlet.ServletContext inServletContext)
          getContentType() can be used to return the value that will be set as the response' contentType header.
 java.io.InputStream getStream(java.lang.String inRequestedResource, java.lang.String inParam1, java.lang.String inParam2, javax.servlet.ServletContext inServletContext)
          getStream() is the method that returns the InputStream to the resource to to be served.
 

Method Detail

getStream

public java.io.InputStream getStream(java.lang.String inRequestedResource,
                                     java.lang.String inParam1,
                                     java.lang.String inParam2,
                                     javax.servlet.ServletContext inServletContext)
getStream() is the method that returns the InputStream to the resource to to be served.

Parameters:
inRequestedResource - This is the resource that is being requested. This might be a URL, a file system path, or a database identifier, whatever is appropriate to the source of the resource.
inParam1 - First arbitrary parameter from web.xml.
inParam2 - Second arbitrary parameter from web.xml.
inServletContext - The ServletContext of the calling ResourceServerServlet.
Returns:
An InputStream on the resource to be served.

getContentType

public java.lang.String getContentType(java.lang.String inRequestedResource,
                                       java.lang.String inParam1,
                                       java.lang.String inParam2,
                                       javax.servlet.ServletContext inServletContext)
getContentType() can be used to return the value that will be set as the response' contentType header. For instance, if you want to set up the ResourceServerServlet to serve different types of resources from a database, and you have a field in the database that contains whatthe content type is, you can read that field here and return it.

Parameters:
inRequestedResource - This is the resource that is being requested. This might be a URL, a file system path, or a database identifier, whatever is appropriate to the source of the resource.
inParam1 - First arbitrary parameter from web.xml.
inParam2 - Second arbitrary parameter from web.xml.
inServletContext - The ServletContext of the calling ResourceServerServlet.
Returns:
The content type of the resource. YOU MUST RETURN NULL IF THIS METHOD WILL NOT BE USED TO SET THE CONTENT TYPE!


Copyright 2005 Frank W. Zammetti