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
Abstract resource implementation for archive-based resources.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractArchiveResource.JarInputStreamWrapperThis 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 protectedAbstractArchiveResource(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 booleancanRead()Checks if this resource can be read.booleandelete()Deletes this resource.protected java.io.InputStreamdoGetInputStream()Returns the input stream for this resource.booleanexists()Checks if this resource exists.protected AbstractArchiveResourceSetgetArchiveResourceSet()Returns the archive resource set.protected java.lang.StringgetBase()Returns the base.protected java.lang.StringgetBaseUrl()Returns the base URL.java.lang.StringgetCanonicalPath()Returns the canonical path of this resource.java.security.cert.Certificate[]getCertificates()Returns the certificates that were used to sign this resource to verify it.java.net.URLgetCodeBase()byte[]getContent()Returns the binary content of this resource.longgetContentLength()Returns the content length of this resource.longgetCreation()Returns the creation time of this resource.protected abstract AbstractArchiveResource.JarInputStreamWrappergetJarInputStreamWrapper()longgetLastModified()Returns the last modified time.java.util.jar.ManifestgetManifest()Returns the manifest associated with this resource.java.lang.StringgetName()Returns the name of this resource.protected java.util.jar.JarEntrygetResource()Returns the resource.java.net.URLgetURL()Returns a URL to access this resource.booleanisDirectory()Checks if this resource is a directory.booleanisFile()Checks if this resource is a file.booleanisVirtual()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, getStrongETag, 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()
Returns the archive resource set.- Returns:
- the archive resource set
-
getBase
protected final java.lang.String getBase()
Returns the base.- Returns:
- the base
-
getBaseUrl
protected final java.lang.String getBaseUrl()
Returns the base URL.- Returns:
- the base URL
-
getResource
protected final java.util.jar.JarEntry getResource()
Returns the resource.- Returns:
- the resource
-
getLastModified
public long getLastModified()
Description copied from interface:WebResourceReturns the last modified time.- Returns:
File.lastModified().
-
exists
public boolean exists()
Description copied from interface:WebResourceChecks if this resource exists.- Returns:
File.exists().
-
isVirtual
public boolean isVirtual()
Description copied from interface:WebResourceIndicates 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:
truefor a virtual resource
-
isDirectory
public boolean isDirectory()
Description copied from interface:WebResourceChecks if this resource is a directory.- Returns:
File.isDirectory().
-
isFile
public boolean isFile()
Description copied from interface:WebResourceChecks if this resource is a file.- Returns:
File.isFile().
-
delete
public boolean delete()
Description copied from interface:WebResourceDeletes this resource.- Returns:
File.delete().
-
getName
public java.lang.String getName()
Description copied from interface:WebResourceReturns the name of this resource.- Returns:
File.getName().
-
getContentLength
public long getContentLength()
Description copied from interface:WebResourceReturns the content length of this resource.- Returns:
File.length().
-
getCanonicalPath
public java.lang.String getCanonicalPath()
Description copied from interface:WebResourceReturns the canonical path of this resource.- Returns:
File.getCanonicalPath().
-
canRead
public boolean canRead()
Description copied from interface:WebResourceChecks if this resource can be read.- Returns:
File.canRead().
-
getCreation
public long getCreation()
Description copied from interface:WebResourceReturns the creation time of this resource.- Returns:
- The time the file was created. If not available, the result of
WebResource.getLastModified()will be returned.
-
getURL
public java.net.URL getURL()
Description copied from interface:WebResourceReturns a URL to access this resource.- Returns:
- a URL to access the resource or
nullif 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()
Description copied from interface:WebResourceReturns the binary content of this resource.- Returns:
- the binary content of this resource or
nullif it is not available in a byte[] because, for example, it is too big.
-
getCertificates
public java.security.cert.Certificate[] getCertificates()
Description copied from interface:WebResourceReturns the certificates that were used to sign this resource to verify it.- 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()
Description copied from interface:WebResourceReturns the manifest associated with this resource.- Returns:
- the manifest associated with this resource or @null if none.
- See Also:
JarFile.getManifest()
-
doGetInputStream
protected final java.io.InputStream doGetInputStream()
Description copied from class:AbstractResourceReturns the input stream for this resource.- Specified by:
doGetInputStreamin classAbstractResource- Returns:
- the input stream for this resource
-
getJarInputStreamWrapper
protected abstract AbstractArchiveResource.JarInputStreamWrapper getJarInputStreamWrapper()
-
-