Package org.apache.catalina.webresources
Class AbstractArchiveResource
- java.lang.Object
-
- org.apache.catalina.webresources.AbstractResource
-
- org.apache.catalina.webresources.AbstractArchiveResource
-
- All Implemented Interfaces:
WebResource
- Direct Known Subclasses:
AbstractSingleArchiveResource
,JarWarResource
public abstract class AbstractArchiveResource extends AbstractResource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractArchiveResource.JarInputStreamWrapper
This wrapper assumes that the InputStream was created from a JarFile obtained from a call to getArchiveResourceSet().openJarFile().
-
Field Summary
-
Fields inherited from class org.apache.catalina.webresources.AbstractResource
sm
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractArchiveResource(AbstractArchiveResourceSet archiveResourceSet, java.lang.String webAppPath, java.lang.String baseUrl, java.util.jar.JarEntry jarEntry, java.lang.String codeBaseUrl)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canRead()
boolean
delete()
protected java.io.InputStream
doGetInputStream()
boolean
exists()
protected AbstractArchiveResourceSet
getArchiveResourceSet()
protected java.lang.String
getBase()
protected java.lang.String
getBaseUrl()
java.lang.String
getCanonicalPath()
java.security.cert.Certificate[]
getCertificates()
java.net.URL
getCodeBase()
byte[]
getContent()
long
getContentLength()
long
getCreation()
protected abstract AbstractArchiveResource.JarInputStreamWrapper
getJarInputStreamWrapper()
long
getLastModified()
java.util.jar.Manifest
getManifest()
java.lang.String
getName()
protected java.util.jar.JarEntry
getResource()
java.net.URL
getURL()
boolean
isDirectory()
boolean
isFile()
boolean
isVirtual()
Indicates if this resource is required for applications to correctly scan the file structure but that does not exist in either the main or any additionalWebResourceSet
.-
Methods inherited from class org.apache.catalina.webresources.AbstractResource
getETag, getInputStream, getLastModifiedHttp, getLog, getMimeType, getWebappPath, getWebResourceRoot, setMimeType
-
-
-
-
Constructor Detail
-
AbstractArchiveResource
protected AbstractArchiveResource(AbstractArchiveResourceSet archiveResourceSet, java.lang.String webAppPath, java.lang.String baseUrl, java.util.jar.JarEntry jarEntry, java.lang.String codeBaseUrl)
-
-
Method Detail
-
getArchiveResourceSet
protected AbstractArchiveResourceSet getArchiveResourceSet()
-
getBase
protected final java.lang.String getBase()
-
getBaseUrl
protected final java.lang.String getBaseUrl()
-
getResource
protected final java.util.jar.JarEntry getResource()
-
getLastModified
public long getLastModified()
- Returns:
File.lastModified()
.
-
exists
public boolean exists()
- Returns:
File.exists()
.
-
isVirtual
public boolean isVirtual()
Description copied from interface:WebResource
Indicates if this resource is required for applications to correctly scan the file structure but that does not exist in either the main or any additionalWebResourceSet
. For example, if an external directory is mapped to /WEB-INF/lib in an otherwise empty web application, /WEB-INF will be represented as a virtual resource.- Returns:
true
for a virtual resource
-
isDirectory
public boolean isDirectory()
- Returns:
File.isDirectory()
.
-
isFile
public boolean isFile()
- Returns:
File.isFile()
.
-
delete
public boolean delete()
- Returns:
File.delete()
.
-
getName
public java.lang.String getName()
- Returns:
File.getName()
.
-
getContentLength
public long getContentLength()
- Returns:
File.length()
.
-
getCanonicalPath
public java.lang.String getCanonicalPath()
- Returns:
File.getCanonicalPath()
.
-
canRead
public boolean canRead()
- Returns:
File.canRead()
.
-
getCreation
public long getCreation()
- Returns:
- The time the file was created. If not available, the result of
WebResource.getLastModified()
will be returned.
-
getURL
public java.net.URL getURL()
- Returns:
- a URL to access the resource or
null
if no such URL is available or if the resource does not exist.
-
getCodeBase
public java.net.URL getCodeBase()
- Returns:
- the code base for this resource that will be used when looking up the assigned permissions for the code base in the security policy file when running under a security manager.
-
getContent
public final byte[] getContent()
- Returns:
- the binary content of this resource or
null
if it is not available in a byte[] because, for example, it is too big.
-
getCertificates
public java.security.cert.Certificate[] getCertificates()
- Returns:
- the certificates that were used to sign this resource to verify it or @null if none.
- See Also:
JarEntry.getCertificates()
-
getManifest
public java.util.jar.Manifest getManifest()
- Returns:
- the manifest associated with this resource or @null if none.
- See Also:
JarFile.getManifest()
-
doGetInputStream
protected final java.io.InputStream doGetInputStream()
- Specified by:
doGetInputStream
in classAbstractResource
-
getJarInputStreamWrapper
protected abstract AbstractArchiveResource.JarInputStreamWrapper getJarInputStreamWrapper()
-
-