Package org.apache.catalina.webresources
Class AbstractResource
- java.lang.Object
-
- org.apache.catalina.webresources.AbstractResource
-
- All Implemented Interfaces:
WebResource
- Direct Known Subclasses:
AbstractArchiveResource,FileResource,JarResourceRoot
public abstract class AbstractResource extends java.lang.Object implements WebResource
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringManagersm
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractResource(WebResourceRoot root, java.lang.String webAppPath)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.io.InputStreamdoGetInputStream()Returns the input stream for this resource.java.lang.StringgetETag()Returns the weak ETag calculated from the content length and last modified.java.io.InputStreamgetInputStream()Obtains an InputStream based on the contents of this resource.java.lang.StringgetLastModifiedHttp()Returns the last modified time in HTTP format.protected abstract LoggetLog()java.lang.StringgetMimeType()Returns the MIME type for this Resource.java.lang.StringgetStrongETag()Return the strong ETag if available else return the weak ETag calculated from the content length and last modified.java.lang.StringgetWebappPath()Returns the webapp path of this resource.WebResourceRootgetWebResourceRoot()Returns a reference to the WebResourceRoot of which this WebResource is a part.voidsetMimeType(java.lang.String mimeType)Set the MIME type for this Resource.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.catalina.WebResource
canRead, delete, exists, getCanonicalPath, getCertificates, getCodeBase, getContent, getContentLength, getCreation, getLastModified, getManifest, getName, getURL, isDirectory, isFile, isVirtual
-
-
-
-
Field Detail
-
sm
protected static final StringManager sm
-
-
Constructor Detail
-
AbstractResource
protected AbstractResource(WebResourceRoot root, java.lang.String webAppPath)
-
-
Method Detail
-
getWebResourceRoot
public final WebResourceRoot getWebResourceRoot()
Description copied from interface:WebResourceReturns a reference to the WebResourceRoot of which this WebResource is a part.- Specified by:
getWebResourceRootin interfaceWebResource- Returns:
- a reference to the WebResourceRoot of which this WebResource is a part.
-
getWebappPath
public final java.lang.String getWebappPath()
Description copied from interface:WebResourceReturns the webapp path of this resource.- Specified by:
getWebappPathin interfaceWebResource- Returns:
- The path of this resource relative to the web application root. If the resource is a directory, the return value will end in '/'.
-
getLastModifiedHttp
public final java.lang.String getLastModifiedHttp()
Description copied from interface:WebResourceReturns the last modified time in HTTP format.- Specified by:
getLastModifiedHttpin interfaceWebResource- Returns:
- the last modified time of this resource in the correct format for the HTTP Last-Modified header as specified by RFC 2616.
-
getETag
public final java.lang.String getETag()
Description copied from interface:WebResourceReturns the weak ETag calculated from the content length and last modified.- Specified by:
getETagin interfaceWebResource- Returns:
- The ETag for this resource
-
getStrongETag
public final java.lang.String getStrongETag()
Description copied from interface:WebResourceReturn the strong ETag if available else return the weak ETag calculated from the content length and last modified.- Specified by:
getStrongETagin interfaceWebResource- Returns:
- The ETag for this resource
-
setMimeType
public final void setMimeType(java.lang.String mimeType)
Description copied from interface:WebResourceSet the MIME type for this Resource.- Specified by:
setMimeTypein interfaceWebResource- Parameters:
mimeType- The mime type that will be associated with the resource
-
getMimeType
public final java.lang.String getMimeType()
Description copied from interface:WebResourceReturns the MIME type for this Resource.- Specified by:
getMimeTypein interfaceWebResource- Returns:
- the MIME type for this Resource.
-
getInputStream
public final java.io.InputStream getInputStream()
Description copied from interface:WebResourceObtains an InputStream based on the contents of this resource.- Specified by:
getInputStreamin interfaceWebResource- Returns:
- An InputStream based on the contents of this resource or
nullif the resource does not exist or does not represent a file
-
doGetInputStream
protected abstract java.io.InputStream doGetInputStream()
Returns the input stream for this resource.- Returns:
- the input stream for this resource
-
getLog
protected abstract Log getLog()
-
-