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

public Class JarWarResourceSet

extends AbstractArchiveResourceSet
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.net.MalformedURLException, java.util.HashMap, .Iterator, .Map, .Map.Entry, java.util.jar.JarEntry, .JarFile, .JarInputStream, .Manifest, org.apache.catalina.LifecycleException, .WebResource, .WebResourceRoot, org.apache.tomcat.util.buf.UriUtil

Represents a org.apache.catalina.WebResourceSet based on a JAR file that is nested inside a packed WAR file. This is only intended for internal use within Tomcat and therefore cannot be created via configuration.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final String
Inherited from org.apache.catalina.webresources.AbstractArchiveResourceSet:
archiveEntriesarchiveLock

Constructor Summary

AccessConstructor and Description
public
JarWarResourceSet(WebResourceRoot root, String
The path within the web application at which this org.apache.catalina.WebResourceSet will be mounted.
webAppMount
,
String
The absolute path to the WAR file on the file system in which the JAR is located.
base
,
String
The path within the WAR file where the JAR file is located.
archivePath
,
String
The path within this new org.apache.catalina.WebResourceSet where resources will be served from. E.g. for a resource JAR, this would be "META-INF/resources"
internalPath
)

Creates a new org.apache.catalina.WebResourceSet based on a JAR file that is nested inside a WAR.

Method Summary

Modifier and TypeMethod and Description
protected WebResource
protected Map<String, JarEntry>
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
)

Implements abstract org.apache.catalina.webresources.AbstractArchiveResourceSet.getArchiveEntries.

Obtain the map of entries in the archive.

protected JarEntry
getArchiveEntry(String
The path in the archive of the entry required
pathInArchive
)

Implements abstract org.apache.catalina.webresources.AbstractArchiveResourceSet.getArchiveEntry.

Obtain a single entry from the archive.

protected void
initInternal()

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

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

protected boolean
protected void
Inherited from org.apache.catalina.webresources.AbstractArchiveResourceSet:
closeJarFilegcgetBaseUrlgetBaseUrlStringgetResourceisReadOnlylistlistWebAppPathsmkdiropenJarFilesetBaseUrlsetReadOnlywrite

Field Detail

archivePathback to summary
private final String archivePath

Constructor Detail

JarWarResourceSetback to summary
public JarWarResourceSet(WebResourceRoot root, String webAppMount, String base, String archivePath, String internalPath) throws IllegalArgumentException

Creates a new org.apache.catalina.WebResourceSet based on a JAR file that is nested inside a WAR.

Parameters
root:WebResourceRoot

The WebResourceRoot this new org.apache.catalina.WebResourceSet will be added to.

webAppMount:String

The path within the web application at which this org.apache.catalina.WebResourceSet will be mounted.

base:String

The absolute path to the WAR file on the file system in which the JAR is located.

archivePath:String

The path within the WAR file where the JAR file is located.

internalPath:String

The path within this new org.apache.catalina.WebResourceSet where resources will be served from. E.g. for a resource JAR, this would be "META-INF/resources"

Exceptions
IllegalArgumentException:
if the webAppMount or internalPath is not valid (valid paths must start with '/')

Method Detail

createArchiveResourceback to summary
protected WebResource createArchiveResource(JarEntry jarEntry, String webAppPath, Manifest manifest)

Implements abstract org.apache.catalina.webresources.AbstractArchiveResourceSet.createArchiveResource.

Annotations
@Override
getArchiveEntriesback to summary
protected Map<String, JarEntry> getArchiveEntries(boolean single)

Implements abstract org.apache.catalina.webresources.AbstractArchiveResourceSet.getArchiveEntries.

Doc from org.apache.catalina.webresources.AbstractArchiveResourceSet.getArchiveEntries.

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

JarWar can't optimise for a single resource so the Map is always returned.

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.

Annotations
@Override
getArchiveEntryback to summary
protected JarEntry getArchiveEntry(String pathInArchive)

Implements abstract org.apache.catalina.webresources.AbstractArchiveResourceSet.getArchiveEntry.

Doc from org.apache.catalina.webresources.AbstractArchiveResourceSet.getArchiveEntry.

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.

Should never be called since getArchiveEntries(boolean) always returns a Map.

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

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
isMultiReleaseback to summary
protected boolean isMultiRelease()

Implements abstract org.apache.catalina.webresources.AbstractArchiveResourceSet.isMultiRelease.

Annotations
@Override
processArchivesEntriesForMultiReleaseback to summary
protected void processArchivesEntriesForMultiRelease()
org.apache.catalina.webresources back to summary

private final Class JarWarResourceSet.VersionedJarEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.catalina.webresources.JarWarResourceSet.VersionedJarEntry

Field Summary

Modifier and TypeField and Description
private final JarEntry
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
VersionedJarEntry(int version, JarEntry jarEntry)

Method Summary

Modifier and TypeMethod and Description
public JarEntry
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jarEntryback to summary
private final JarEntry jarEntry
versionback to summary
private final int version

Constructor Detail

VersionedJarEntryback to summary
pack-priv VersionedJarEntry(int version, JarEntry jarEntry)

Method Detail

getJarEntryback to summary
public JarEntry getJarEntry()
getVersionback to summary
public int getVersion()