Class GUID


public class GUID extends URLWithScheme
Represents an opaque (non-hierarchical) URL that has a scheme and an opaque value but no host or port, e.g. data:text/html,..., blob:..., or javascript:alert(1).

In the URL Standard these are URLs whose scheme is not a special scheme. The host and port are always null; the "path" holds the opaque data after the scheme and colon.

Author:
Salvation Team
See Also:
  • Constructor Details

    • GUID

      public GUID(String scheme, String value)
      Constructs a GUID (opaque URL) with the given scheme and opaque value.

      The host is set to null and the port is set to null. The opaque value is stored as the "path" component.

      Parameters:
      scheme - the URL scheme (e.g. "javascript", "data", "blob"); will be lowercased
      value - the opaque data after the scheme colon (e.g. "alert(1)" for javascript:alert(1))
  • Method Details

    • parseGUID

      public static Optional<GUID> parseGUID(String value)
      Parses an opaque URL from its string representation.

      The input must begin with a valid scheme followed by a colon (e.g. "data:text/html,..."). Everything after the colon is stored as the opaque value.

      Parameters:
      value - the URL string to parse
      Returns:
      an Optional containing the parsed GUID, or empty if the value does not begin with a valid scheme