com.ibm.as400.util.html

Class URLParser



  • public class URLParser
    extends Object
    The URLParser class parses a URL string for the URI, properties, and reference (also known as the "anchor"). The reference is indicated by the sharp sign character "#" followed by more characters. For example,
      http://www.toolbox.com/index.html#answer1
      

    The reference indicates that after the specified resource is retrieved, the application is specifically interested in that part of the document that has the tag answer1 attached to it.

    For example, the following URL string can be parsed into its individual components:

      http://myWebSite.com/servlet/myServlet#2043562?parm1="/library/test1#partA"
      

    Here are the individual pieces of the URL:

      URL: http://myWebSite.com/servlet/myServlet#2043562?parm1="/library/test1#partA"
      URI: http://myWebSite.com/servlet/myServlet
      Reference: 2043562
      Parameter: {parm1="/library/test1#partA"}
      
    • Constructor Detail

      • URLParser

        public URLParser(String url)
        Constructs a URLParser object with the specified url.
        Parameters:
        url - The url to parse.
    • Method Detail

      • getURL

        public String getURL()
        Returns the URL.
        Returns:
        The URL.
      • getURI

        public String getURI()
        Returns the URI.
        Returns:
        The URI.
      • getURI

        public static String getURI(javax.servlet.http.HttpServletRequest request)
        Returns the URI from the specified request.
        Parameters:
        request - The HttpServletRequest.
        Returns:
        The URI.
      • getReference

        public String getReference()
        Returns the reference, also known as the "anchor".
        Returns:
        The reference.
      • getParameters

        public Properties getParameters()
        Returns the parameters.
        Returns:
        The parameters.
      • getHTMLHyperlink

        public HTMLHyperlink getHTMLHyperlink(String text)
        Returns the HTMLHyperlink.
        Returns:
        The HTMLHyperlink.
      • getServletHyperlink

        public ServletHyperlink getServletHyperlink(String text)
        Returns the ServletHyperlink.
        Returns:
        The ServletHyperlink.