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 webAppMount,
String base,
String archivePath,
String internalPath)
Creates a new
WebResourceSet for this WebResourceRoot
based on the provided parameters. |
void |
createWebResourceSet(WebResourceRoot.ResourceSetType type,
String webAppMount,
URL url,
String internalPath)
Creates a new
WebResourceSet for this WebResourceRoot
based on the provided parameters. |
void |
deregisterTrackedResource(TrackedWebResource trackedResource) |
boolean |
getAllowLinking()
Determine if this resources allow the use of symbolic links.
|
List<URL> |
getBaseUrls()
Obtain the set of
WebResourceSet.getBaseUrl() for all
WebResourceSet s used by this root. |
long |
getCacheMaxSize()
Get the maximum permitted size for the cache.
|
int |
getCacheObjectMaxSize()
Get the maximum permitted size for a single object in the cache.
|
long |
getCacheTtl()
Get the Time-To-Live (TTL) for cache entries.
|
WebResource |
getClassLoaderResource(String path)
Obtain the object that represents the class loader resource at the given
path.
|
WebResource[] |
getClassLoaderResources(String path)
Obtain the objects that represent the class loader resource at the given
path.
|
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 objects that represent the resource at the given path.
|
boolean |
getTrackLockedFiles()
Has the track locked files feature been enabled?
|
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 |
registerTrackedResource(TrackedWebResource trackedResource) |
void |
setAllowLinking(boolean allowLinking)
Configure if this resources allow the use of symbolic links.
|
void |
setCacheMaxSize(long cacheMaxSize)
Set the maximum permitted size for the cache.
|
void |
setCacheObjectMaxSize(int cacheObjectMaxSize)
Set the maximum permitted size for a single object in 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.
|
void |
setTrackLockedFiles(boolean trackLockedFiles)
Controls whether the track locked files feature is enabled.
|
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 '/'.WebResource getClassLoaderResource(String path)
path
- The path of the class loader resource of interest relative
to the the root of class loader resources for this web
application.WebResource[] getClassLoaderResources(String path)
path
- The path for the class loader resource of interest relative
to the root of the class loader resources for 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, String webAppMount, URL url, String internalPath)
WebResourceSet
for this WebResourceRoot
based on the provided parameters.type
- The type of WebResourceSet
to createwebAppMount
- The path within the web application that the
resources should be published at. It must start
with '/'.url
- The URL of the resource (must locate a JAR, file or
directory)internalPath
- The path within the resource where the content is to
be found. It must start with '/'.void createWebResourceSet(WebResourceRoot.ResourceSetType type, String webAppMount, String base, String archivePath, String internalPath)
WebResourceSet
for this WebResourceRoot
based on the provided parameters.type
- The type of WebResourceSet
to createwebAppMount
- The path within the web application that the
resources should be published at. It must start
with '/'.base
- The location of the resourcesarchivePath
- The path within the resource to the archive where
the content is to be found. If there is no
archive then this should be null
.internalPath
- The path within the archive (or the resource if the
archivePath is null
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 setCacheObjectMaxSize(int cacheObjectMaxSize)
Integer.MAX_VALUE
.cacheObjectMaxSize
- Maximum size for a single cached object in
kilobytesint getCacheObjectMaxSize()
Integer.MAX_VALUE
.void setTrackLockedFiles(boolean trackLockedFiles)
WebResource.getInputStream()
will perform a number of additional tasks.
trackLockedFiles
- true
to enable it, false
to
disable itboolean getTrackLockedFiles()
true
if it has been enabled, otherwise false
void backgroundProcess()
void registerTrackedResource(TrackedWebResource trackedResource)
void deregisterTrackedResource(TrackedWebResource trackedResource)
List<URL> getBaseUrls()
WebResourceSet.getBaseUrl()
for all
WebResourceSet
s used by this root.Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.