Package org.apache.hc.core5.net
Enum URIBuilder.EncodingPolicy
- java.lang.Object
-
- java.lang.Enum<URIBuilder.EncodingPolicy>
-
- org.apache.hc.core5.net.URIBuilder.EncodingPolicy
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<URIBuilder.EncodingPolicy>
- Enclosing class:
- URIBuilder
public static enum URIBuilder.EncodingPolicy extends java.lang.Enum<URIBuilder.EncodingPolicy>
Defines the encoding policy for URI components inURIBuilder. 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 Summary
Enum Constants Enum Constant Description ALL_RESERVEDEncodes all reserved characters, allowing only unreserved characters (ALPHA, DIGIT, "-", ".", "_", "~") to remain unencoded.RFC_3986Follows RFC 3986 component-specific encoding rules.
-
Constructor Summary
Constructors Modifier Constructor Description privateEncodingPolicy()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URIBuilder.EncodingPolicyvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static URIBuilder.EncodingPolicy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 byPercentCodec.FRAGMENT. This policy ensures compliance with RFC 3986 while maintaining interoperability.
-
-
Method Detail
-
values
public static URIBuilder.EncodingPolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (URIBuilder.EncodingPolicy c : URIBuilder.EncodingPolicy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static URIBuilder.EncodingPolicy valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
-