Top Fields Constructors Methods
org.apache.catalina.webresources

public abstract Class AbstractArchiveResourceSet

extends AbstractResourceSet
Class Inheritance
Known Direct Subclasses
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet, org.apache.catalina.webresources.JarWarResourceSet
Imports
java.io.File, .IOException, .InputStream, java.net.URL, java.util.ArrayList, .Map, .Set, java.util.jar.JarEntry, .JarFile, .Manifest, java.util.zip.ZipFile, org.apache.catalina.WebResource, .WebResourceRoot, org.apache.catalina.util.ResourceSet

Field Summary

Modifier and TypeField and Description
private JarFile
protected Map<String, JarEntry>
protected final Object
private long
private URL
private String
private JarContents
private boolean
Inherited from org.apache.catalina.webresources.AbstractResourceSet:
sm

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected abstract WebResource
createArchiveResource(JarEntry jarEntry, String webAppPath, Manifest manifest)

public void
gc()

Implements org.apache.catalina.WebResourceSet.gc.

Implementations may cache some information to improve performance.

protected abstract Map<String, JarEntry>

Returns:

The archives entries mapped to their names or null if getArchiveEntry(String) should be used.
getArchiveEntries
(boolean
Is this request being make to support a single lookup? If false, a map will always be returned. If true, implementations may use this as a hint in determining the optimum way to respond.
single
)

Obtain the map of entries in the archive.

protected abstract JarEntry

Returns:

The specified archive entry or null if it does not exist
getArchiveEntry
(String
The path in the archive of the entry required
pathInArchive
)

Obtain a single entry from the archive.

public final URL
getBaseUrl()

Implements org.apache.catalina.WebResourceSet.getBaseUrl.

Obtain the base URL for this set of resources.

protected final String
public final 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.

protected abstract boolean
public final boolean
isReadOnly()

Implements org.apache.catalina.WebResourceSet.isReadOnly.

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

public final 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 final 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 final 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.

protected JarFile
protected final void
setBaseUrl(URL baseUrl)

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 final 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.webresources.AbstractResourceSet:
checkPathdestroyInternalgetBasegetClassLoaderOnlygetInternalPathgetManifestgetRootgetStaticOnlygetWebAppMountsetBasesetClassLoaderOnlysetInternalPathsetManifestsetRootsetStaticOnlysetWebAppMountstartInternalstopInternal

Field Detail

archiveback to summary
private JarFile archive
archiveEntriesback to summary
protected Map<String, JarEntry> archiveEntries
archiveLockback to summary
protected final Object archiveLock
archiveUseCountback to summary
private long archiveUseCount
baseUrlback to summary
private URL baseUrl
baseUrlStringback to summary
private String baseUrlString
jarContentsback to summary
private JarContents jarContents
retainBloomFilterForArchivesback to summary
private boolean retainBloomFilterForArchives

Constructor Detail

AbstractArchiveResourceSetback to summary
public AbstractArchiveResourceSet()

Method Detail

closeJarFileback to summary
protected void closeJarFile()
createArchiveResourceback to summary
protected abstract WebResource createArchiveResource(JarEntry jarEntry, String webAppPath, Manifest manifest)
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
getArchiveEntriesback to summary
protected abstract Map<String, JarEntry> getArchiveEntries(boolean single)

Obtain the map of entries in the archive. May return null in which case getArchiveEntry(String) should be used.

Parameters
single:boolean

Is this request being make to support a single lookup? If false, a map will always be returned. If true, implementations may use this as a hint in determining the optimum way to respond.

Returns:Map<String, JarEntry>

The archives entries mapped to their names or null if getArchiveEntry(String) should be used.

getArchiveEntryback to summary
protected abstract JarEntry getArchiveEntry(String pathInArchive)

Obtain a single entry from the archive. For performance reasons, getArchiveEntries(boolean) should always be called first and the archive entry looked up in the map if one is returned. Only if that call returns null should this method be used.

Parameters
pathInArchive:String

The path in the archive of the entry required

Returns:JarEntry

The specified archive entry or null if it does not exist

getBaseUrlback to summary
public final 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.

Returns:URL

The base URL for this set of resources

Annotations
@Override
getBaseUrlStringback to summary
protected final String getBaseUrlString()
getResourceback to summary
public final 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.

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
isMultiReleaseback to summary
protected abstract boolean isMultiRelease()
isReadOnlyback to summary
public final 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.

Returns:boolean

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

Annotations
@Override
listback to summary
public final 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.

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 final 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.

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 final 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.

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
openJarFileback to summary
protected JarFile openJarFile() throws IOException
Annotations
@SuppressWarnings:deprecation
setBaseUrlback to summary
protected final void setBaseUrl(URL baseUrl)
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.

Parameters
readOnly:boolean

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

Annotations
@Override
writeback to summary
public final 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.

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