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

# Class VirtualResource

java.lang.Object
org.apache.catalina.webresources.EmptyResource
org.apache.catalina.webresources.VirtualResource

All Implemented Interfaces:
  `WebResource`

public class VirtualResource extends EmptyResource
A virtual resource that represents a directory entry created on-the-fly.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VirtualResource(WebResourceRoot root, String webAppPath, String name)`
  Constructs a new VirtualResource.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Returns the name of this resource.
  `boolean`
  `isDirectory()`
  Checks if this resource is a directory.
  `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`.

  ### Methods inherited from class EmptyResource

  `canRead, delete, exists, getCanonicalPath, getCertificates, getCodeBase, getContent, getContentLength, getCreation, getETag, getInputStream, getLastModified, getLastModifiedHttp, getManifest, getMimeType, getURL, getWebappPath, getWebResourceRoot, isFile, setMimeType`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface WebResource

  `getStrongETag`

- ## Constructor Details

  - ### VirtualResource

    public VirtualResource(WebResourceRoot root, String webAppPath, String name)
    Constructs a new VirtualResource.
    Parameters:
      `root` - The root resource set
      `webAppPath` - The web application path
      `name` - The resource name

- ## Method Details

  - ### isVirtual

    public boolean isVirtual()
    Description copied from interface: `WebResource`
    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.
    Specified by:
      `isVirtual` in interface `WebResource`
    Overrides:
      `isVirtual` in class `EmptyResource`
    Returns:
      `true` for a virtual resource

  - ### isDirectory

    public boolean isDirectory()
    Description copied from interface: `WebResource`
    Checks if this resource is a directory.
    Specified by:
      `isDirectory` in interface `WebResource`
    Overrides:
      `isDirectory` in class `EmptyResource`
    Returns:
      `File.isDirectory()`.

  - ### getName

    public String getName()
    Description copied from interface: `WebResource`
    Returns the name of this resource.
    Specified by:
      `getName` in interface `WebResource`
    Overrides:
      `getName` in class `EmptyResource`
    Returns:
      `File.getName()`.