org.orbeon.oxf.resources
Class WebAppResourceManagerImpl

java.lang.Object
  extended byorg.orbeon.oxf.resources.ResourceManagerBase
      extended byorg.orbeon.oxf.resources.WebAppResourceManagerImpl
All Implemented Interfaces:
ResourceManager

public class WebAppResourceManagerImpl
extends org.orbeon.oxf.resources.ResourceManagerBase

The webapp resource manager is able to load resources from a WAR file. This is very useful when distributing packaged applications.


Nested Class Summary
 
Nested classes inherited from class org.orbeon.oxf.resources.ResourceManagerBase
org.orbeon.oxf.resources.ResourceManagerBase.ResourceManagerXMLReader
 
Field Summary
static String ROOT_DIR
           
static String SERVLET_CONTEXT_KEY
           
 
Constructor Summary
WebAppResourceManagerImpl(Map props)
           
 
Method Summary
 boolean canWrite()
          Indicates if the resource manager implementation suports write operations
 Reader getContentAsReader(String key)
          Returns a character reader from the resource manager for the specified key.
 InputStream getContentAsStream(String key)
          Returns a binary input stream for the specified key.
 OutputStream getOutputStream(String key)
          Allows writing to the resource
 String getRealPath(String key)
          Returns the path to the given resource on the file system.
 Writer getWriter(String key)
          Allow writing to the resource
protected  long lastModifiedImpl(String key)
          Gets the last modified timestamp for the specofoed resource
 int length(String key)
          Returns the length of the file denoted by this abstract pathname.
 
Methods inherited from class org.orbeon.oxf.resources.ResourceManagerBase
getContentAsDOM, getContentAsDOM4J, getContentAsSAX, getWriteContentHandler, getXMLReader, getXMLReader, invalidateLastModifiedCache, lastModified, writeDOM, writeDOM4J
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVLET_CONTEXT_KEY

public static final String SERVLET_CONTEXT_KEY

ROOT_DIR

public static final String ROOT_DIR
See Also:
Constant Field Values
Constructor Detail

WebAppResourceManagerImpl

public WebAppResourceManagerImpl(Map props)
Method Detail

getContentAsReader

public Reader getContentAsReader(String key)
Returns a character reader from the resource manager for the specified key. The key could point to any text document.

Parameters:
key - A Resource Manager key
Returns:
a character reader

getContentAsStream

public InputStream getContentAsStream(String key)
Returns a binary input stream for the specified key. The key could point to any document type (text or binary).

Parameters:
key - A Resource Manager key
Returns:
a input stream

lastModifiedImpl

protected long lastModifiedImpl(String key)
Gets the last modified timestamp for the specofoed resource

Parameters:
key - A Resource Manager key
Returns:
a timestamp

canWrite

public boolean canWrite()
Indicates if the resource manager implementation suports write operations

Returns:
true if write operations are allowed

getOutputStream

public OutputStream getOutputStream(String key)
Allows writing to the resource

Parameters:
key - A Resource Manager key
Returns:
an output stream

getWriter

public Writer getWriter(String key)
Allow writing to the resource

Parameters:
key - A Resource Manager key
Returns:
a writer

length

public int length(String key)
Returns the length of the file denoted by this abstract pathname.

Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist

getRealPath

public String getRealPath(String key)
Description copied from interface: ResourceManager
Returns the path to the given resource on the file system. If a path on the local file system cannot be provided by the resource manager, null is returned.