AbstractResource (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.catalina.webresources, class: AbstractResource

# 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
Abstract `WebResource` implementation that provides common functionality for all web resource implementations.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  The string manager for this class.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractResource(WebResourceRoot root, String webAppPath)`
  Constructs a new AbstractResource.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract InputStream`
  `doGetInputStream()`
  Returns the input stream for this resource.
  `final String`
  `getETag()`
  Gets the weak ETag for this resource.
  `final InputStream`
  `getInputStream()`
  Gets the input stream for this resource.
  `final String`
  `getLastModifiedHttp()`
  Gets the last modified date as an HTTP date string.
  `protected abstract Log`
  `getLog()`
  Gets the logger for this resource.
  `final String`
  `getMimeType()`
  Gets the MIME type for this resource.
  `final String`
  `getStrongETag()`
  Gets the strong ETag for this resource.
  `final String`
  `getWebappPath()`
  Gets the web app path.
  `final WebResourceRoot`
  `getWebResourceRoot()`
  Gets the web resource root.
  `final void`
  `setMimeType(String mimeType)`
  Sets the MIME type for this resource.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface WebResource

  `canRead, delete, exists, getCanonicalPath, getCertificates, getCodeBase, getContent, getContentLength, getCreation, getLastModified, getManifest, getName, getURL, isDirectory, isFile, isVirtual`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    The string manager for this class.

- ## Constructor Details

  - ### AbstractResource

    protected AbstractResource(WebResourceRoot root, String webAppPath)
    Constructs a new AbstractResource.
    Parameters:
      `root` - The root
      `webAppPath` - The web app path

- ## Method Details

  - ### getWebResourceRoot

    public final WebResourceRoot getWebResourceRoot()
    Gets the web resource root.
    Specified by:
      `getWebResourceRoot` in interface `WebResource`
    Returns:
      The web resource root

  - ### getWebappPath

    public final String getWebappPath()
    Gets the web app path.
    Specified by:
      `getWebappPath` in interface `WebResource`
    Returns:
      The web app path

  - ### getLastModifiedHttp

    public final String getLastModifiedHttp()
    Gets the last modified date as an HTTP date string.
    Specified by:
      `getLastModifiedHttp` in interface `WebResource`
    Returns:
      The last modified date as an HTTP date string

  - ### getETag

    public final String getETag()
    Gets the weak ETag for this resource.
    Specified by:
      `getETag` in interface `WebResource`
    Returns:
      The weak ETag

  - ### getStrongETag

    public final String getStrongETag()
    Gets the strong ETag for this resource.
    Specified by:
      `getStrongETag` in interface `WebResource`
    Returns:
      The strong ETag

  - ### setMimeType

    public final void setMimeType(String mimeType)
    Sets the MIME type for this resource.
    Specified by:
      `setMimeType` in interface `WebResource`
    Parameters:
      `mimeType` - The MIME type

  - ### getMimeType

    public final String getMimeType()
    Gets the MIME type for this resource.
    Specified by:
      `getMimeType` in interface `WebResource`
    Returns:
      The MIME type

  - ### getInputStream

    public final InputStream getInputStream()
    Gets the input stream for this resource.
    Specified by:
      `getInputStream` in interface `WebResource`
    Returns:
      the input stream for this resource

  - ### doGetInputStream

    protected abstract InputStream doGetInputStream()
    Returns the input stream for this resource.
    Returns:
      the input stream for this resource

  - ### getLog

    protected abstract Log getLog()
    Gets the logger for this resource.
    Returns:
      the logger