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 Object
    implements WebResource

### Field Summary

Fields
`protected static StringManager` `sm`

### Constructor Summary

Constructors
`protected` `AbstractResource​(WebResourceRoot root, String webAppPath)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract InputStream` `doGetInputStream()`
`String` `getETag()` Return the strong ETag if available (currently not supported) else return the weak ETag calculated from the content length and last modified.
`InputStream` `getInputStream()` Obtain an InputStream based on the contents of this resource.
`String` `getLastModifiedHttp()`
`protected abstract Log` `getLog()`
`String` `getMimeType()`
`String` `getWebappPath()`
`WebResourceRoot` `getWebResourceRoot()`
`void` `setMimeType​(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,
                               String webAppPath)

### Method Detail

#### getWebResourceRoot

    public final WebResourceRoot getWebResourceRoot()

Specified by:
  `getWebResourceRoot` in interface `WebResource`
Returns:
  a reference to the WebResourceRoot of which this WebResource is a part.

#### getWebappPath

    public final String getWebappPath()

Specified by:
  `getWebappPath` in interface `WebResource`
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 String getLastModifiedHttp()

Specified by:
  `getLastModifiedHttp` in interface `WebResource`
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 String getETag()

Description copied from interface: `WebResource`
Return the strong ETag if available (currently not supported) else return the weak ETag calculated from the content length and last modified.

Specified by:
  `getETag` in interface `WebResource`
Returns:
  The ETag for this resource

#### setMimeType

    public final void setMimeType​(String mimeType)

Description copied from interface: `WebResource`
Set the MIME type for this Resource.

Specified by:
  `setMimeType` in interface `WebResource`
Parameters:
  `mimeType` - The mime type that will be associated with the resource

#### getMimeType

    public final String getMimeType()

Specified by:
  `getMimeType` in interface `WebResource`
Returns:
  the MIME type for this Resource.

#### getInputStream

    public final InputStream getInputStream()

Description copied from interface: `WebResource`
Obtain an InputStream based on the contents of this resource.

Specified by:
  `getInputStream` in interface `WebResource`
Returns:
  An InputStream based on the contents of this resource or `null` if the resource does not exist or does not represent a file

#### doGetInputStream

    protected abstract InputStream doGetInputStream()

#### getLog

    protected abstract Log getLog()