TldResourcePath (Apache Tomcat 10.1.48 API Documentation)
Description: declaration: package: org.apache.tomcat.util.descriptor.tld, class: TldResourcePath

# Class TldResourcePath

java.lang.Object
org.apache.tomcat.util.descriptor.tld.TldResourcePath

public class TldResourcePath extends Object
A TLD Resource Path as defined in JSP 7.3.2.

This encapsulates references to Tag Library Descriptors that can be located in different places:

- As resources within an application
- As entries in JAR files included in the application
- As resources provided by the container

When configuring a mapping from a well-known URI to a TLD, a user is allowed to specify just the name of a JAR file that implicitly contains a TLD in `META-INF/taglib.tld`. Such a mapping must be explicitly converted to a URL and entryName when using this implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TldResourcePath(URL url, String webappPath)`
  Constructor identifying a TLD resource directly.
  `TldResourcePath(URL url, String webappPath, String entryName)`
  Constructor identifying a TLD packaged within a JAR file.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `String`
  `getEntryName()`
  Returns the name of the JAR entry that contains the TLD.
  `URL`
  `getUrl()`
  Returns the URL of the TLD or of the JAR containing the TLD.
  `String`
  `getWebappPath()`
  Returns the path within the web application, if any, that the resource returned by `getUrl()` was obtained from.
  `int`
  `hashCode()`
  `Jar`
  `openJar()`
  `InputStream`
  `openStream()`
  Opens a stream to access the TLD.
  `String`
  `toExternalForm()`
  Return the external form of the URL representing this TLD.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### TldResourcePath

    public TldResourcePath(URL url, String webappPath)
    Constructor identifying a TLD resource directly.
    Parameters:
      `url` - the location of the TLD
      `webappPath` - the web application path, if any, of the TLD

  - ### TldResourcePath

    public TldResourcePath(URL url, String webappPath, String entryName)
    Constructor identifying a TLD packaged within a JAR file.
    Parameters:
      `url` - the location of the JAR
      `webappPath` - the web application path, if any, of the JAR
      `entryName` - the name of the entry in the JAR

- ## Method Details

  - ### getUrl

    public URL getUrl()
    Returns the URL of the TLD or of the JAR containing the TLD.
    Returns:
      the URL of the TLD

  - ### getWebappPath

    public String getWebappPath()
    Returns the path within the web application, if any, that the resource returned by `getUrl()` was obtained from.
    Returns:
      the web application path or @null if the resource is not located within a web application

  - ### getEntryName

    public String getEntryName()
    Returns the name of the JAR entry that contains the TLD. May be null to indicate the URL refers directly to the TLD itself.
    Returns:
      the name of the JAR entry that contains the TLD

  - ### toExternalForm

    public String toExternalForm()
    Return the external form of the URL representing this TLD. This can be used as a canonical location for the TLD itself, for example, as the systemId to use when parsing its XML.
    Returns:
      the external form of the URL representing this TLD

  - ### openStream

    public InputStream openStream() throws IOException
    Opens a stream to access the TLD.
    Returns:
      a stream containing the TLD content
    Throws:
      `IOException` - if there was a problem opening the stream

  - ### openJar

    public Jar openJar() throws IOException
    Throws:
      `IOException`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`