java.lang.Object
com.google.gerrit.extensions.restapi.Url

public final class Url extends Object
URL related utility functions.
  • Method Details

    • encode

      public static String encode(String component)
      Encode a path segment, escaping characters not valid for a URL.

      The following characters are not escaped:

      • a..z, A..Z, 0..9
      • . - * _

      ' ' (space) is encoded as '+'.

      All other characters (including '/') are converted to the triplet "%xy" where "xy" is the hex representation of the character in UTF-8.

      Parameters:
      component - a string containing text to encode.
      Returns:
      a string with all invalid URL characters escaped.
    • decode

      public static String decode(String str)
      Decode a URL encoded string, e.g. from "%2F" to "/".