public interface WebResourceRoot extends Lifecycle
Modifier and Type | Interface and Description |
---|---|
static class |
WebResourceRoot.ResourceSetType |
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Modifier and Type | Method and Description |
---|---|
void |
addJarResources(WebResourceSet webResourceSet)
Adds the provided WebResourceSet to this web application as a 'Jar'
resource.
|
void |
addPostResources(WebResourceSet webResourceSet)
Adds the provided WebResourceSet to this web application as a 'Post'
resource.
|
void |
addPreResources(WebResourceSet webResourceSet)
Adds the provided WebResourceSet to this web application as a 'Pre'
resource.
|
void |
backgroundProcess()
This method will be invoked by the context on a periodic basis and allows
the implementation a method that executes periodic tasks, such as purging
expired cache entries.
|
void |
createWebResourceSet(WebResourceRoot.ResourceSetType type,
String base,
String webAppMount,
String internalPath)
Creates a new
WebResourceSet for this WebResourceRoot
based on the provided parameters. |
void |
createWebResourceSet(WebResourceRoot.ResourceSetType type,
URL url,
String webAppMount,
String internalPath)
Creates a new
WebResourceSet for this WebResourceRoot
based on the provided parameters. |
boolean |
getAllowLinking()
Determine if this resources allow the use of symbolic links.
|
long |
getCacheMaxObjectSize()
Get the maximum permitted size for a single object in the cache.
|
long |
getCacheMaxSize()
Get the maximum permitted size for the cache.
|
long |
getCacheTtl()
Get the Time-To-Live (TTL) for cache entries.
|
Context |
getContext()
Obtain the web application this WebResourceRoot is associated with.
|
WebResourceSet[] |
getJarResources()
Get the list of WebResourceSet configured to this web application
as a 'Jar' resource.
|
WebResourceSet[] |
getPostResources()
Get the list of WebResourceSet configured to this web application
as a 'Post' resource.
|
WebResourceSet[] |
getPreResources()
Get the list of WebResourceSet configured to this web application
as a 'Pre' resource.
|
WebResource |
getResource(String path)
Obtain the object that represents the resource at the given path.
|
WebResource[] |
getResources(String path)
Obtain the object(s) that represent the resource at the given path.
|
boolean |
isCachingAllowed()
Get whether or not caching is permitted for this web application.
|
String[] |
list(String path)
Obtain the list of the names of all of the files and directories located
in the specified directory.
|
WebResource[] |
listResources(String path)
Obtain the list of all of the WebResources in the specified directory.
|
Set<String> |
listWebAppPaths(String path)
Obtain the Set of the web applications pathnames of all of the files and
directories located in the specified directory.
|
boolean |
mkdir(String path)
Create a new directory at the given path.
|
void |
setAllowLinking(boolean allowLinking)
Configure if this resources allow the use of symbolic links.
|
void |
setCacheMaxObjectSize(long cacheMaxObjectSize)
Set the maximum permitted size for a single object in the cache.
|
void |
setCacheMaxSize(long cacheMaxSize)
Set the maximum permitted size for the cache.
|
void |
setCacheTtl(long ttl)
Set the Time-To-Live (TTL) for cache entries.
|
void |
setCachingAllowed(boolean cachingAllowed)
Set whether or not caching is permitted for this web application.
|
void |
setContext(Context context)
Set the web application this WebResourceRoot is associated with.
|
boolean |
write(String path,
InputStream is,
boolean overwrite)
Create a new resource at the requested path using the provided
InputStream.
|
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
WebResource getResource(String path)
path
- The path for the resource of interest relative to the root
of the web application. It must start with '/'.WebResource[] getResources(String path)
path
- The path for the resource of interest relative to the root
of the web application. It must start with '/'.String[] list(String path)
path
- The path for the resource of interest relative to the root
of the web application. It must start with '/'.Set<String> listWebAppPaths(String path)
path
- The path for the resource of interest relative to the root
of the web application. It must start with '/'.WebResource[] listResources(String path)
path
- The path for the resource of interest relative to the root
of the web application. It must start with '/'.boolean mkdir(String path)
path
- The path for the new resource to create relative to the root
of the web application. It must start with '/'.true
if the directory was created, otherwise
false
boolean write(String path, InputStream is, boolean overwrite)
path
- The path to be used for the new Resource. It is relative
to the root of the web application and must start with
'/'.is
- The InputStream that will provide the content for the
new Resource.overwrite
- If true
and the resource already exists it
will be overwritten. If false
and the
resource already exists the write will fail.true
if and only if the new Resource is writtenvoid createWebResourceSet(WebResourceRoot.ResourceSetType type, URL url, String webAppMount, String internalPath)
WebResourceSet
for this WebResourceRoot
based on the provided parameters.type
- The type of WebResourceSet
to createurl
- The URL of the resource (must locate a JAR, file or
directory)webAppMount
- The path within the web application that the
resources should be published at. It must start
with '/'.internalPath
- The path within the resource where the content is to
be found. It must start with '/'.void createWebResourceSet(WebResourceRoot.ResourceSetType type, String base, String webAppMount, String internalPath)
WebResourceSet
for this WebResourceRoot
based on the provided parameters.type
- The type of WebResourceSet
to createbase
- The location of the resourceswebAppMount
- The path within the web application that the
resources should be published at. It must start
with '/'.internalPath
- The path within the resource where the content is to
be found. It must start with '/'.void addPreResources(WebResourceSet webResourceSet)
WebResourceSet[] getPreResources()
void addJarResources(WebResourceSet webResourceSet)
WebResourceSet[] getJarResources()
void addPostResources(WebResourceSet webResourceSet)
WebResourceSet[] getPostResources()
Context getContext()
void setContext(Context context)
void setAllowLinking(boolean allowLinking)
allowLinking
- true
if symbolic links are allowed.boolean getAllowLinking()
true
if symbolic links are allowedvoid setCachingAllowed(boolean cachingAllowed)
cachingAllowed
- true
to enable caching, else
false
boolean isCachingAllowed()
void setCacheTtl(long ttl)
ttl
- TTL in millisecondslong getCacheTtl()
void setCacheMaxSize(long cacheMaxSize)
cacheMaxSize
- Maximum cache size in kilobyteslong getCacheMaxSize()
void setCacheMaxObjectSize(long cacheMaxObjectSize)
cacheMaxObjectSize
- Maximum size for a single cached object in
kilobyteslong getCacheMaxObjectSize()
void backgroundProcess()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.