javawebparts.servlet
Class ResourceStreamFromJAR

java.lang.Object
  |
  +--javawebparts.servlet.ResourceStreamFromJAR
All Implemented Interfaces:
ResourceStream

public class ResourceStreamFromJAR
extends java.lang.Object
implements ResourceStream

This conrete implementation of the ResourceStream interface is used to serve resources from a JAR file in the classpath. Note that this implementation assumes the content type is set either using the value of the defaultContentType init parameter of the ResourceServerServlet, or via mapping file, so null is returned by getContentType().

streamParam1 and streamParam2 are not used by this implementation.

Author:
Frank W. Zammetti.

Field Summary
private static org.apache.commons.logging.Log log
          Log instance.
 
Constructor Summary
ResourceStreamFromJAR()
           
 
Method Summary
 java.lang.String getContentType(java.lang.String inRequestedResource, java.lang.String inParam1, java.lang.String inParam2, javax.servlet.ServletContext inServletContext)
          This implementation assumes the content type is set either using the value of the defaultContentType init parameter of the ResourceServerServlet, or via mapping file, so null is returned by getContentType().
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Log instance.

Constructor Detail

ResourceStreamFromJAR

public ResourceStreamFromJAR()
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.

Specified by:
getStream in interface ResourceStream
Parameters:
inRequestedResource - This is the resource that is being requested. This should be a path specifier WITHOUT leading slash.
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)
This implementation assumes the content type is set either using the value of the defaultContentType init parameter of the ResourceServerServlet, or via mapping file, so null is returned by getContentType().

Specified by:
getContentType in interface ResourceStream
Parameters:
inRequestedResource - This is the resource that is being requested. This should be a path specifier WITHOUT leading slash.
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, null in this case.


Copyright © 2005 Frank W. Zammetti