Class UriEncoding

java.lang.Object
io.helidon.common.uri.UriEncoding

public final class UriEncoding extends Object
Support for encoding and decoding of URI in HTTP.
  • Method Details

    • decodeUri

      public static String decodeUri(String uriSegment)
      Decode a URI segment.

      Percent characters "%s" found between brackets "[]" are not decoded to support IPv6 literal. E.g. http://[fe80::1%lo0]:8080.

      See RFC 6874, section 2.

      Parameters:
      uriSegment - URI segment with percent encoding
      Returns:
      decoded string
    • decodeQuery

      public static String decodeQuery(String uriQuery)
      Decode a URI query.
      Parameters:
      uriQuery - URI query with percent encoding
      Returns:
      decoded string
    • encodeUri

      public static String encodeUri(String uriSegment)
      Encode a URI segment.
      Parameters:
      uriSegment - URI segment that may contain characters not allowed by the URI
      Returns:
      URI segment with percent encoding
    • encode

      public static String encode(String s, UriEncoding.Type t)
      Encodes the characters of string that are either non-ASCII characters or are ASCII characters that are not allowed.
      Parameters:
      s - the string to be encoded
      t - the URI component type identifying the ASCII characters that must be percent-encoded
      Returns:
      the encoded string