org.enhydra.xml.xmlc.servlet
Class ServletDocumentLoaderImpl
java.lang.Object
|
+--org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl
|
+--org.enhydra.xml.xmlc.servlet.ServletDocumentLoaderImpl
- All Implemented Interfaces:
- DocumentLoader, ServletDocumentLoader
- public class ServletDocumentLoaderImpl
- extends DocumentLoaderImpl
- implements ServletDocumentLoader
A ServletContext aware DocumentLoader implementation. The only behavior
modification from that of the superclass is the installation of a different
resource loader
capable of loading resources from
the servlet context.
Some thought was given to making this the default document loader implementation
for {@lnk XMLCContext}. However, because of the possibility of candidate paths
happening not to match resources in resource dirs or the classpath, then
happening, by accident, to match resources stored in the servlet context not
meant to be loaded by XMLC, it was decided to leave the existing default
({@link DocumentLoaderImpl}) in place. To configure this class as the document
loader, simply add the following to web.xml...
<context-param>
<param-name>xmlcReparseDocumentLoader</param-name>
<param-value>org.enhydra.xml.xmlc.servlet.ServletDocumentLoaderImpl</param-value>
</context-param>
For users wishing to serve resources primarily (or exclusively) from the
servlet context, it may make sense to extend this class, override
{@link #getResourceLoader()}, and provide a custom resource loader.
- Since:
- 2.3.2
- Author:
- Jacob Kjome
Methods inherited from class org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl |
createDOMEditor, createParser, findSourceUrl, getCacheEntry, getClassConstant, getCurrentTimestamp, getDocument, getFactory, getLogger, getSourceFileName, init, loadMetaData, makeCacheKey, parseDocument |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fServletContext
protected javax.servlet.ServletContext fServletContext
ServletDocumentLoaderImpl
public ServletDocumentLoaderImpl()
- See Also:
DocumentLoaderImpl.DocumentLoaderImpl()
ServletDocumentLoaderImpl
public ServletDocumentLoaderImpl(Map cache)
- Parameters:
cache
- a custom cache- See Also:
DocumentLoaderImpl.DocumentLoaderImpl(Map)
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
- Description copied from interface:
ServletDocumentLoader
- Set the servlet context for this instance. If this
document loader is instatiated from the servlet aware
XMLCContext
, this method
is called exactly once for every instance, before any of the
other methods are called. However, a class implenting this
interface should be prepared to run unitialized or at least
fail gracefully, because non servlet aware environments will
probably not initialize the servlet context.
- Specified by:
setServletContext
in interface ServletDocumentLoader
- Parameters:
servletContext
- the current servlet context
getResourceLoader
public ResourceLoader getResourceLoader()
- See
ServletResourceLoaderImpl
for resource loading behavior.
- Specified by:
getResourceLoader
in interface DocumentLoader
- Overrides:
getResourceLoader
in class DocumentLoaderImpl
- Returns:
- a resource loader implementation
- See Also:
ServletResourceLoaderImpl
Copyright © 1999-2007 enhydra.org (Mark Diekhans, David Li, Richard Kunze, Jacob Kjome). All Rights reserved.