Enum URIBuilder.EncodingPolicy

java.lang.Object
java.lang.Enum<URIBuilder.EncodingPolicy>
org.apache.hc.core5.net.URIBuilder.EncodingPolicy
All Implemented Interfaces:
Serializable, Comparable<URIBuilder.EncodingPolicy>, java.lang.constant.Constable
Enclosing class:
URIBuilder

public static enum URIBuilder.EncodingPolicy extends Enum<URIBuilder.EncodingPolicy>
Defines the encoding policy for URI components in URIBuilder. This enum controls how characters are percent-encoded when constructing a URI, allowing flexibility between strict encoding and RFC 3986-compliant behavior.
Since:
5.4
  • Enum Constant Details

    • ALL_RESERVED

      public static final URIBuilder.EncodingPolicy ALL_RESERVED
      Encodes all reserved characters, allowing only unreserved characters (ALPHA, DIGIT, "-", ".", "_", "~") to remain unencoded. This is a strict policy suitable for conservative URI production where maximum encoding is desired.
    • RFC_3986

      public static final URIBuilder.EncodingPolicy RFC_3986
      Follows RFC 3986 component-specific encoding rules. For example, query and fragment components allow unreserved characters, sub-delimiters ("!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="), and additional characters (":", "@", "/", "?") to remain unencoded, as defined by PercentCodec.FRAGMENT. This policy ensures compliance with RFC 3986 while maintaining interoperability.
  • Method Details

    • values

      public static URIBuilder.EncodingPolicy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static URIBuilder.EncodingPolicy valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null