Class TldResourcePath


  • public class TldResourcePath
    extends java.lang.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​(java.net.URL url, java.lang.String webappPath)
      Constructor identifying a TLD resource directly.
      TldResourcePath​(java.net.URL url, java.lang.String webappPath, java.lang.String entryName)
      Constructor identifying a TLD packaged within a JAR file.
    • Method Summary

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

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TldResourcePath

        public TldResourcePath​(java.net.URL url,
                               java.lang.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​(java.net.URL url,
                               java.lang.String webappPath,
                               java.lang.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 Detail

      • getUrl

        public java.net.URL getUrl()
        Returns the URL of the TLD or of the JAR containing the TLD.
        Returns:
        the URL of the TLD
      • getWebappPath

        public java.lang.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 the resource is not located within a web application
      • getEntryName

        public java.lang.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 java.lang.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 java.io.InputStream openStream()
                                       throws java.io.IOException
        Opens a stream to access the TLD.
        Returns:
        a stream containing the TLD content
        Throws:
        java.io.IOException - if there was a problem opening the stream
      • openJar

        public Jar openJar()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object