Top Description Methods
org.apache.catalina

public Interface WebResource

Known Direct Implementers
org.apache.catalina.webresources.AbstractResource, org.apache.catalina.webresources.CachedResource, org.apache.catalina.webresources.EmptyResource
Imports
java.io.InputStream, java.net.URL, java.security.cert.Certificate, java.util.jar.Manifest

Represents a file or directory within a web application. It borrows heavily from java.io.File.

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public boolean
public String
public Certificate[]

Returns:

the certificates that were used to sign this resource to verify it or @null if none.
getCertificates
()

public URL

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.
getCodeBase
()

public byte[]

Returns:

the binary content of this resource or null if it is not available in a byte[] because, for example, it is too big.
getContent
()

public long
public long

Returns:

The time the file was created. If not available, the result of getLastModified() will be returned.
getCreation
()

public String

Returns:

The ETag for this resource
getETag
()

Return the strong ETag if available (currently not supported) else return the weak ETag calculated from the content length and last modified.

public InputStream

Returns:

An InputStream based on the contents of this resource or null if the resource does not exist or does not represent a file
getInputStream
()

Obtain an InputStream based on the contents of this resource.

public long
public String

Returns:

the last modified time of this resource in the correct format for the HTTP Last-Modified header as specified by RFC 2616.
getLastModifiedHttp
()

public Manifest

Returns:

the manifest associated with this resource or @null if none.
getManifest
()

public String

Returns:

the MIME type for this Resource.
getMimeType
()

public String
public URL

Returns:

a URL to access the resource or null if no such URL is available or if the resource does not exist.
getURL
()

public String

Returns:

The path of this resource relative to the web application root. If the resource is a directory, the return value will end in '/'.
getWebappPath
()

public WebResourceRoot

Returns:

a reference to the WebResourceRoot of which this WebResource is a part.
getWebResourceRoot
()

public boolean
public boolean
public boolean

Returns:

true for a virtual resource
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 additional WebResourceSet.

public void
setMimeType(String
The mime type that will be associated with the resource
mimeType
)

Set the MIME type for this Resource.

Method Detail

canReadback to summary
public boolean canRead()
Returns:boolean

java.io.File#canRead().

deleteback to summary
public boolean delete()
Returns:boolean

java.io.File#delete().

existsback to summary
public boolean exists()
Returns:boolean

java.io.File#exists().

getCanonicalPathback to summary
public String getCanonicalPath()
Returns:String

java.io.File#getCanonicalPath().

getCertificatesback to summary
public Certificate[] getCertificates()
Returns:Certificate[]

the certificates that were used to sign this resource to verify it or @null if none.

See Also
java.util.jar.JarEntry#getCertificates()
getCodeBaseback to summary
public URL getCodeBase()
Returns:URL

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.

getContentback to summary
public byte[] getContent()
Returns:byte[]

the binary content of this resource or null if it is not available in a byte[] because, for example, it is too big.

getContentLengthback to summary
public long getContentLength()
Returns:long

java.io.File#length().

getCreationback to summary
public long getCreation()
Returns:long

The time the file was created. If not available, the result of getLastModified() will be returned.

getETagback to summary
public String getETag()

Return the strong ETag if available (currently not supported) else return the weak ETag calculated from the content length and last modified.

Returns:String

The ETag for this resource

getInputStreamback to summary
public InputStream getInputStream()

Obtain an InputStream based on the contents of this resource.

Returns:InputStream

An InputStream based on the contents of this resource or null if the resource does not exist or does not represent a file

getLastModifiedback to summary
public long getLastModified()
Returns:long

java.io.File#lastModified().

getLastModifiedHttpback to summary
public String getLastModifiedHttp()
Returns:String

the last modified time of this resource in the correct format for the HTTP Last-Modified header as specified by RFC 2616.

getManifestback to summary
public Manifest getManifest()
Returns:Manifest

the manifest associated with this resource or @null if none.

See Also
java.util.jar.JarFile#getManifest()
getMimeTypeback to summary
public String getMimeType()
Returns:String

the MIME type for this Resource.

getNameback to summary
public String getName()
Returns:String

java.io.File#getName().

getURLback to summary
public URL getURL()
Returns:URL

a URL to access the resource or null if no such URL is available or if the resource does not exist.

getWebappPathback to summary
public String getWebappPath()
Returns:String

The path of this resource relative to the web application root. If the resource is a directory, the return value will end in '/'.

getWebResourceRootback to summary
public WebResourceRoot getWebResourceRoot()
Returns:WebResourceRoot

a reference to the WebResourceRoot of which this WebResource is a part.

isDirectoryback to summary
public boolean isDirectory()
Returns:boolean

java.io.File#isDirectory().

isFileback to summary
public boolean isFile()
Returns:boolean

java.io.File#isFile().

isVirtualback to summary
public 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 additional WebResourceSet. 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:boolean

true for a virtual resource

setMimeTypeback to summary
public void setMimeType(String mimeType)

Set the MIME type for this Resource.

Parameters
mimeType:String

The mime type that will be associated with the resource