org.onemind.jxp
Class ResourceStreamPageSource

java.lang.Object
  extended by org.onemind.jxp.JxpPageSource
      extended by org.onemind.jxp.CachingPageSource
          extended by org.onemind.jxp.ResourceStreamPageSource

public class ResourceStreamPageSource
extends CachingPageSource

A JxpResourceSource uses resources from classpath as pages

Author:
TiongHiang Lee (thlee@onemindsoft.org)

Field Summary
private  java.lang.String _pathPrefix
          the prefix *
 
Constructor Summary
ResourceStreamPageSource(java.lang.String pathPrefix)
          
ResourceStreamPageSource(java.lang.String pathPrefix, java.lang.String encoding)
          
 
Method Summary
 java.lang.String getPathPrefix()
          Get the path prefix
 java.lang.String getStreamName(java.lang.String pageName)
          
protected  boolean hasStream(java.lang.String pageName)
          Whether there's input stream from given page name
protected  boolean isExpired(CachedJxpPage page)
          Whether a page is expired
protected  java.io.InputStream loadStream(CachedJxpPage page)
          Load the input stream for the page
 void setPathPrefix(java.lang.String pathPrefix)
          Set the pathPrefix
 
Methods inherited from class org.onemind.jxp.CachingPageSource
assignPageStaticVariable, declarePageStaticVariable, getEncoding, getErrorSource, getJxpDocument, getJxpPage, getPageStaticVariable, hasJxpPage, hasPageStaticVariable, invalidatePageCache, isCaching, isJxpPageCached, purgeStaticVariables, setCaching, setEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_pathPrefix

private java.lang.String _pathPrefix
the prefix *

Constructor Detail

ResourceStreamPageSource

public ResourceStreamPageSource(java.lang.String pathPrefix)


ResourceStreamPageSource

public ResourceStreamPageSource(java.lang.String pathPrefix,
                                java.lang.String encoding)

Method Detail

getPathPrefix

public final java.lang.String getPathPrefix()
Get the path prefix

Returns:
the path prefix

getStreamName

public final java.lang.String getStreamName(java.lang.String pageName)


setPathPrefix

public final void setPathPrefix(java.lang.String pathPrefix)
Set the pathPrefix

Parameters:
pathPrefix - The pathPrefix to set.

isExpired

protected boolean isExpired(CachedJxpPage page)
Whether a page is expired

Specified by:
isExpired in class CachingPageSource
Parameters:
page - the page
Returns:
true if expired

hasStream

protected boolean hasStream(java.lang.String pageName)
Whether there's input stream from given page name

Specified by:
hasStream in class CachingPageSource
Parameters:
pageName - the page name
Returns:
true if has input stream

loadStream

protected java.io.InputStream loadStream(CachedJxpPage page)
                                  throws java.io.IOException
Load the input stream for the page

Specified by:
loadStream in class CachingPageSource
Returns:
the input stream
Throws:
java.io.IOException