Class Uris

java.lang.Object
com.forgerock.util.Uris

public final class Uris extends Object
DO NOT USE: Internal utility class for performing operations on universal resource identifiers.
  • Method Details

    • urlDecodeFragment

      public static String urlDecodeFragment(String fragment)
      Decodes the provided URL encoded fragment as per RFC 3986.
      Parameters:
      fragment - the URL encoded fragment, which may be null.
      Returns:
      the decoded fragment, or null if fragment was null.
    • urlEncodeFragment

      public static String urlEncodeFragment(String fragment)
      URL encodes the provided fragment as per RFC 3986.
      Parameters:
      fragment - the fragment, which may be null.
      Returns:
      the URL encoded fragment, or null if fragment was null.
    • urlEncode

      public static String urlEncode(String s, BitSet safeChars)
      URL encodes the provided string using the specified set of safe characters. Characters not present in the safeChars set are percent-encoded as UTF-8 octets.
      Parameters:
      s - the string to encode, which may be null.
      safeChars - a BitSet representing characters that do not require encoding.
      Returns:
      the URL-encoded string, or null if s was null.
    • urlDecode

      public static String urlDecode(String s, boolean decodePlusToSpace)
      Decodes a URL-encoded string, converting percent-encoded sequences back to their original characters. Optionally converts plus signs (+) to spaces if decodePlusToSpace is true.
      Parameters:
      s - the URL-encoded string to decode, which may be null.
      decodePlusToSpace - if true, plus signs will be decoded as spaces.
      Returns:
      the decoded string, or null if s was null.
      Throws:
      IllegalArgumentException - if the input contains incomplete or invalid percent-encoded sequences.