Class URL_URN

java.lang.Object
com.iizix.urn.URN
com.iizix.urn.url.URL_URN
All Implemented Interfaces:
Serializable, Cloneable

public class URL_URN extends URN implements Cloneable, Serializable
URL Uniform Resource Naming (URN) instance class, holding the URL.

IIZI URL URN's are formatted as:

    urn:iz-url:utf8encodedPath[?+query][#fragment]

where the url:utf8encodedPath is the file resource path encoded in UTF-8, followed by an optional query and an optional fragment.

The IIZI URL URN's will then represent the following URL:

    webServerHost[?query][#fragment]

where webServerHost will be the external web server unsecure protocol http:// or secure https:// followed by the external host name or IP address of the web server. In case of clustering and/or usage of redundant servers, the name may be an alias that will direct the actual HTTP[S] request to the correct party in question.

Author:
Christopher Mindus
See Also:
  • Method Details

    • fromURL

      Creates a URL URN from a string containing an optional '?' query and '#' fragment.
      Parameters:
      url - The URL string.
      Throws:
      NullPointerException - If the url is null.
      MalformedURLException - If the url is malformed.
      MalformedURNException - If the url is malformed for an IIZI URN URL.
      URISyntaxException - If the url has a syntax error in its URI (for an IIZI URN URL).
    • fromURL

      public static URL_URN fromURL(String url, String query, String fragment) throws MalformedURLException, MalformedURNException, URISyntaxException
      Creates a URL URN from a string and an optional query and fragment.
      Parameters:
      url - The URL base string without query and fragment.
      query - The query string, or null for none. The query, if defined, will be appended to the URL prefixed by '?'. No encoding will be done, so it is important that the query is correctly encoded, e.g. parameters specified as abc=enc(data)&def=enc(data) where "enc(data)" URI-encodes the specific data using UTF-8 character set.
      fragment - The fragment part, null for none. The fragment will not be encoded, but if present, appended to the url with '#' before.
      Throws:
      NullPointerException - If the url is null.
      MalformedURLException - If the url is malformed.
      MalformedURNException - If the url is malformed for an IIZI URN URL.
      URISyntaxException - If the url has a syntax error in its URI (for an IIZI URN URL).
    • fromURL

      public static URL_URN fromURL(URL url) throws MalformedURNException
      Creates a URL URN from a string and an optional query and fragment.
      Parameters:
      url - The URL.
      Throws:
      NullPointerException - If the url is null.
      MalformedURNException - If the url is malformed for an IIZI URN URL.
    • getURL

      public String getURL()
      Gets the URL of this resource relative the current web server.
      Specified by:
      getURL in class URN
      Returns:
      The full URL to the resource.
    • getParamString

      public String getParamString()
      Gets the parameter string for the URN.toString() method.
      Specified by:
      getParamString in class URN
      Returns:
      The parameter string, always non-null.
    • hashCode

      public int hashCode()
      Hash code of this instance.
      Specified by:
      hashCode in class URN
      Returns:
      The hash code.
    • equals

      public boolean equals(Object obj)
      Checks if two instances are equal.
      Specified by:
      equals in class URN
      Parameters:
      obj - The other instance.
      Returns:
      The equals flag.