Package snap.web

Class ParsedURL

java.lang.Object
snap.web.ParsedURL

public class ParsedURL extends Object
A class to parse a URL string and provide the parts. Has the form: [Scheme:][//Authority][/Path[!/Path]][?Query][#HashTag]. Authority has the form: [UserInfo@]Host[:Port].
  • Constructor Details

    • ParsedURL

      public ParsedURL(String aStr)
      Constructor for given string.
  • Method Details

    • getString

      public String getString()
      Returns the URL string.
    • parseString

      protected void parseString(String aStr)
      Sets the string and it's pieces.
    • getScheme

      public String getScheme()
      Returns the URL Scheme (lower case).
    • getSiteId

      public String getSiteId()
      Returns the site id string.
    • getSiteUrl

      public String getSiteUrl()
      Returns the site string.
    • getUser

      public String getUser()
      Returns the User part of the URL.
    • getPort

      public int getPort()
      Returns the port of the URL.
    • getPath

      public String getPath()
      Returns the part of the string that describes the file path.
    • getFilename

      public String getFilename()
      Returns the last component of the file path.
    • getFilenameSimple

      public String getFilenameSimple()
      Returns the filename without extension.
    • getQuery

      public String getQuery()
      Returns the part of the URL string that describes the query.
    • getQueryValue

      public String getQueryValue(String aKey)
      Returns the value for given Query key in URL, if available.
    • getHashtag

      public String getHashtag()
      Returns the hashtag reference from the URL as a simple string.
    • getHashtagValue

      public String getHashtagValue(String aKey)
      Returns the value for given hashtag key in URL, if available.
    • isFileURL

      public boolean isFileURL()
      Returns whether URL specifies only the file (no query/hashtags).
    • getFileURL

      public String getFileURL()
      Returns the URL string for the file only (no query/hashtags).
    • isQueryURL

      public boolean isQueryURL()
      Returns whether URL specifies only file and query (no hashtag references).
    • getQueryURL

      public String getQueryURL()
      Returns the URL string for the file and query only (no hashtag references).
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Standard HashCode implementation.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object