Top Description Fields Constructors Methods
org.apache.catalina.webresources

public Class EmptyResourceSet

extends LifecycleBase
implements WebResourceSet
Class Inheritance
All Implemented Interfaces
org.apache.catalina.WebResourceSet, org.apache.catalina.Lifecycle
Imports
java.io.InputStream, java.net.URL, java.util.Collections, .Set, org.apache.catalina.LifecycleException, .LifecycleState, .WebResource, .WebResourceRoot, .WebResourceSet, org.apache.catalina.util.LifecycleBase

A WebResourceSet implementation that is not backed by a file system and behaves as if it has no resources available. This is primarily used in embedded mode when the web application is configured entirely programmatically and does not use any static resources from the file system.

Field Summary

Modifier and TypeField and Description
private boolean
private static final String[]
private WebResourceRoot
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
destroyInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.destroyInternal.

Sub-classes implement this method to perform any instance destruction required.

public void
gc()

Implements org.apache.catalina.WebResourceSet.gc.

Implementations may cache some information to improve performance.

public URL
getBaseUrl()

Implements org.apache.catalina.WebResourceSet.getBaseUrl.

Obtain the base URL for this set of resources.

public boolean
getClassLoaderOnly()

Implements org.apache.catalina.WebResourceSet.getClassLoaderOnly.

Should resources returned by this resource set only be included in any results when the lookup is explicitly looking for class loader resources.

public WebResource
getResource(String
The path for the resource of interest relative to the root of the web application. It must start with '/'.
path
)

Implements org.apache.catalina.WebResourceSet.getResource.

Obtain the object that represents the resource at the given path.

public boolean
getStaticOnly()

Implements org.apache.catalina.WebResourceSet.getStaticOnly.

Should resources returned by this resource set only be included in any results when the lookup is explicitly looking for static (non-class loader) resources.

protected void
initInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.initInternal.

Sub-classes implement this method to perform any instance initialisation required.

public boolean
isReadOnly()

Implements org.apache.catalina.WebResourceSet.isReadOnly.

Obtains the current value of the read-only setting for this set of resources.

public String[]
list(String
The path for the resource of interest relative to the root of the web application. It must start with '/'.
path
)

Implements org.apache.catalina.WebResourceSet.list.

Obtain the list of the names of all of the files and directories located in the specified directory.

public Set<String>
listWebAppPaths(String
The path for the resource of interest relative to the root of the web application. It must start with '/'.
path
)

Implements org.apache.catalina.WebResourceSet.listWebAppPaths.

Obtain the Set of the web applications pathnames of all of the files and directories located in the specified directory.

public boolean
mkdir(String
The path for the new resource to create relative to the root of the web application. It must start with '/'.
path
)

Implements org.apache.catalina.WebResourceSet.mkdir.

Create a new directory at the given path.

public void
public void
setReadOnly(boolean
true if this set of resources should be configured to be read-only
readOnly
)

Implements org.apache.catalina.WebResourceSet.setReadOnly.

Configures whether or not this set of resources is read-only.

public void
public void
protected void
startInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.startInternal.

Sub-classes must ensure that the state is changed to LifecycleState#STARTING during the execution of this method.

protected void
stopInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.stopInternal.

Sub-classes must ensure that the state is changed to LifecycleState#STOPPING during the execution of this method.

public boolean
write(String
The path to be used for the new Resource. It is relative to the root of the web application and must start with '/'.
path
,
InputStream
The InputStream that will provide the content for the new Resource.
is
,
boolean
If true and the resource already exists it will be overwritten. If false and the resource already exists the write will fail.
overwrite
)

Implements org.apache.catalina.WebResourceSet.write.

Create a new resource at the requested path using the provided InputStream.

Inherited from org.apache.catalina.util.LifecycleBase:
addLifecycleListenerdestroyfindLifecycleListenersfireLifecycleEventgetStategetStateNamegetThrowOnFailureinitremoveLifecycleListenersetStatesetStatesetThrowOnFailurestartstop

Field Detail

classLoaderOnlyback to summary
private boolean classLoaderOnly
EMPTY_STRING_ARRAYback to summary
private static final String[] EMPTY_STRING_ARRAY
rootback to summary
private WebResourceRoot root
staticOnlyback to summary
private boolean staticOnly

Constructor Detail

EmptyResourceSetback to summary
public EmptyResourceSet(WebResourceRoot root)

Method Detail

destroyInternalback to summary
protected void destroyInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.destroyInternal.

Doc from org.apache.catalina.util.LifecycleBase.destroyInternal.

Sub-classes implement this method to perform any instance destruction required.

Annotations
@Override
Exceptions
LifecycleException:
If the destruction fails
gcback to summary
public void gc()

Implements org.apache.catalina.WebResourceSet.gc.

Doc from org.apache.catalina.WebResourceSet.gc.

Implementations may cache some information to improve performance. This method triggers the clean-up of those resources.

Annotations
@Override
getBaseUrlback to summary
public URL getBaseUrl()

Implements org.apache.catalina.WebResourceSet.getBaseUrl.

Doc from org.apache.catalina.WebResourceSet.getBaseUrl.

Obtain the base URL for this set of resources. One of the uses of this is to grant read permissions to the resources when running under a security manager.

This implementation always returns null.

Returns:URL

The base URL for this set of resources

Annotations
@Override
getClassLoaderOnlyback to summary
public boolean getClassLoaderOnly()

Implements org.apache.catalina.WebResourceSet.getClassLoaderOnly.

Doc from org.apache.catalina.WebResourceSet.getClassLoaderOnly.

Should resources returned by this resource set only be included in any results when the lookup is explicitly looking for class loader resources. i.e. should these resources be excluded from look ups that are explicitly looking for static (non-class loader) resources.

Returns:boolean

true if these resources should only be used for class loader resource lookups, otherwise false

Annotations
@Override
getResourceback to summary
public WebResource getResource(String path)

Implements org.apache.catalina.WebResourceSet.getResource.

Doc from org.apache.catalina.WebResourceSet.getResource.

Obtain the object that represents the resource at the given path. Note the resource at that path may not exist.

This implementation always returns an EmptyResource.

Parameters
path:String

The path for the resource of interest relative to the root of the web application. It must start with '/'.

Returns:WebResource

The object that represents the resource at the given path

Annotations
@Override
getStaticOnlyback to summary
public boolean getStaticOnly()

Implements org.apache.catalina.WebResourceSet.getStaticOnly.

Doc from org.apache.catalina.WebResourceSet.getStaticOnly.

Should resources returned by this resource set only be included in any results when the lookup is explicitly looking for static (non-class loader) resources. i.e. should these resources be excluded from look ups that are explicitly looking for class loader resources.

Returns:boolean

true if these resources should only be used for static (non-class loader) resource lookups, otherwise false

Annotations
@Override
initInternalback to summary
protected void initInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.initInternal.

Doc from org.apache.catalina.util.LifecycleBase.initInternal.

Sub-classes implement this method to perform any instance initialisation required.

Annotations
@Override
Exceptions
LifecycleException:
If the initialisation fails
isReadOnlyback to summary
public boolean isReadOnly()

Implements org.apache.catalina.WebResourceSet.isReadOnly.

Doc from org.apache.catalina.WebResourceSet.isReadOnly.

Obtains the current value of the read-only setting for this set of resources.

This implementation always returns true.

Returns:boolean

true if this set of resources is configured to be read-only, otherwise false

Annotations
@Override
listback to summary
public String[] list(String path)

Implements org.apache.catalina.WebResourceSet.list.

Doc from org.apache.catalina.WebResourceSet.list.

Obtain the list of the names of all of the files and directories located in the specified directory.

This implementation always returns an empty array.

Parameters
path:String

The path for the resource of interest relative to the root of the web application. It must start with '/'.

Returns:String[]

The list of resources. If path does not refer to a directory then a zero length array will be returned.

Annotations
@Override
listWebAppPathsback to summary
public Set<String> listWebAppPaths(String path)

Implements org.apache.catalina.WebResourceSet.listWebAppPaths.

Doc from org.apache.catalina.WebResourceSet.listWebAppPaths.

Obtain the Set of the web applications pathnames of all of the files and directories located in the specified directory. Paths representing directories will end with a "/" character.

This implementation always returns an empty set.

Parameters
path:String

The path for the resource of interest relative to the root of the web application. It must start with '/'.

Returns:Set<String>

The Set of resources. If path does not refer to a directory then an empty set will be returned.

Annotations
@Override
mkdirback to summary
public boolean mkdir(String path)

Implements org.apache.catalina.WebResourceSet.mkdir.

Doc from org.apache.catalina.WebResourceSet.mkdir.

Create a new directory at the given path.

This implementation always returns false.

Parameters
path:String

The path for the new resource to create relative to the root of the web application. It must start with '/'.

Returns:boolean

true if the directory was created, otherwise false

Annotations
@Override
setClassLoaderOnlyback to summary
public void setClassLoaderOnly(boolean classLoaderOnly)

Implements org.apache.catalina.WebResourceSet.setClassLoaderOnly.

Annotations
@Override
setReadOnlyback to summary
public void setReadOnly(boolean readOnly)

Implements org.apache.catalina.WebResourceSet.setReadOnly.

Doc from org.apache.catalina.WebResourceSet.setReadOnly.

Configures whether or not this set of resources is read-only.

Calls to this method will be ignored as this implementation always read only.

Parameters
readOnly:boolean

true if this set of resources should be configured to be read-only

Annotations
@Override
setRootback to summary
public void setRoot(WebResourceRoot root)

Implements org.apache.catalina.WebResourceSet.setRoot.

Annotations
@Override
setStaticOnlyback to summary
public void setStaticOnly(boolean staticOnly)

Implements org.apache.catalina.WebResourceSet.setStaticOnly.

Annotations
@Override
startInternalback to summary
protected void startInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.startInternal.

Doc from org.apache.catalina.util.LifecycleBase.startInternal.

Sub-classes must ensure that the state is changed to LifecycleState#STARTING during the execution of this method. Changing state will trigger the Lifecycle#START_EVENT event. If a component fails to start it may either throw a LifecycleException which will cause it's parent to fail to start or it can place itself in the error state in which case stop() will be called on the failed component but the parent component will continue to start normally.

Annotations
@Override
Exceptions
LifecycleException:
Start error occurred
stopInternalback to summary
protected void stopInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.stopInternal.

Doc from org.apache.catalina.util.LifecycleBase.stopInternal.

Sub-classes must ensure that the state is changed to LifecycleState#STOPPING during the execution of this method. Changing state will trigger the Lifecycle#STOP_EVENT event.

Annotations
@Override
Exceptions
LifecycleException:
Stop error occurred
writeback to summary
public boolean write(String path, InputStream is, boolean overwrite)

Implements org.apache.catalina.WebResourceSet.write.

Doc from org.apache.catalina.WebResourceSet.write.

Create a new resource at the requested path using the provided InputStream.

This implementation always returns false.

Parameters
path:String

The path to be used for the new Resource. It is relative to the root of the web application and must start with '/'.

is:InputStream

The InputStream that will provide the content for the new Resource.

overwrite:boolean

If true and the resource already exists it will be overwritten. If false and the resource already exists the write will fail.

Returns:boolean

true if and only if the new Resource is written

Annotations
@Override