public class VirtualDirContext extends FileDirContext
VirtualWebappLoader.
Sample context xml configuration:<Context path="/mywebapp" docBase="/Users/theuser/mywebapp/src/main/webapp" >
<Resources className="org.apache.naming.resources.VirtualDirContext"
extraResourcePaths="/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies" />
<Loader className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="/Users/theuser/mywebapp/target/classes" />
<JarScanner scanAllDirectories="true" />
</Context>
This is not meant to be used for production.
Its meant to ease development with IDE's without the
need for fully republishing jars in WEB-INF/libFileDirContext.FileResource, FileDirContext.FileResourceAttributesabsoluteBase, allowLinking, base, BUFFER_SIZEaliases, altDirContexts, cached, cacheMaxSize, cacheObjectMaxSize, cacheTTL, docBase, env, nameParser, sm| Constructor and Description |
|---|
VirtualDirContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
allocate()
Allocate resources for this directory context.
|
protected java.lang.String |
doGetRealPath(java.lang.String path)
Return the real path for a given virtual path, if possible; otherwise
return
null. |
protected java.lang.Object |
doLookup(java.lang.String name)
Retrieves the named object.
|
protected java.io.File |
file(java.lang.String name)
Return a File object representing the specified normalized
context-relative path if it exists and is readable.
|
protected java.io.File |
file(java.lang.String name,
boolean mustExist)
Return a File object representing the specified normalized
context-relative path if it exists and is readable.
|
javax.naming.directory.Attributes |
getAttributes(java.lang.String name)
Retrieves all of the attributes associated with a named object.
|
protected java.util.List<NamingEntry> |
list(java.io.File file)
List the resources which are members of a collection.
|
void |
release()
Release any resources allocated for this directory context.
|
void |
setExtraResourcePaths(java.lang.String path)
Allows to map a path of the filesystem to a path in the webapp.
|
protected java.io.File |
validate(java.io.File file,
java.lang.String name,
boolean mustExist,
java.lang.String absoluteBase) |
bind, createSubcontext, destroySubcontext, doGetAttributes, doListBindings, getAllowLinking, getNameInNamespace, getSchema, getSchemaClassDefinition, lookupLink, modifyAttributes, modifyAttributes, normalize, rebind, rename, search, search, search, search, setAllowLinking, setDocBase, unbind, validateaddAlias, addAltDirContext, addResourcesJar, addToEnvironment, bind, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, createSubcontext, destroySubcontext, getAliases, getAttributes, getAttributes, getAttributes, getCacheMaxSize, getCacheObjectMaxSize, getCacheTTL, getDocBase, getEnvironment, getNameParser, getNameParser, getRealPath, getSchema, getSchemaClassDefinition, isCached, list, list, listBindings, listBindings, lookup, lookup, lookupLink, modifyAttributes, modifyAttributes, rebind, rebind, rebind, removeAlias, removeFromEnvironment, rename, search, search, search, search, setAliases, setCached, setCacheMaxSize, setCacheObjectMaxSize, setCacheTTL, unbindpublic void setExtraResourcePaths(java.lang.String path)
Allows to map a path of the filesystem to a path in the webapp. Multiple filesystem paths can be mapped to the same path in the webapp. Filesystem path and virtual path must be separated by an equal sign. Pairs of paths must be separated by a comma.
Example:
/=/Users/slaurent/mywebapp/src/main/webapp,/pictures=/Users/slaurent/sharedpictures
The path to the docBase must not be added here, otherwise resources would be listed twice.
path - The set of file system paths and virtual paths to map them to
in the required formatpublic void allocate()
allocate in class BaseDirContextpublic void release()
release in class FileDirContextpublic javax.naming.directory.Attributes getAttributes(java.lang.String name)
throws javax.naming.NamingException
BaseDirContextgetAttributes in interface javax.naming.directory.DirContextgetAttributes in class BaseDirContextname - the name of the object from which to retrieve attributesjavax.naming.NamingException - if a naming exception is encounteredprotected java.io.File file(java.lang.String name)
FileDirContextnull.file in class FileDirContextname - Normalized context-relative path (with leading '/')protected java.io.File file(java.lang.String name,
boolean mustExist)
FileDirContextnull.file in class FileDirContextname - Normalized context-relative path (with leading '/')mustExist - Must the specified resource exist?protected java.util.List<NamingEntry> list(java.io.File file)
FileDirContextlist in class FileDirContextfile - Collectionprotected java.lang.Object doLookup(java.lang.String name)
FileDirContextdoLookup in class FileDirContextname - the name of the object to look upprotected java.lang.String doGetRealPath(java.lang.String path)
FileDirContextnull.doGetRealPath in class FileDirContextpath - The path to the desired resourceprotected java.io.File validate(java.io.File file,
java.lang.String name,
boolean mustExist,
java.lang.String absoluteBase)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.