Enum 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 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 Summary

      Enum Constants 
      Enum Constant Description
      ALL_RESERVED
      Encodes all reserved characters, allowing only unreserved characters (ALPHA, DIGIT, "-", ".", "_", "~") to remain unencoded.
      RFC_3986
      Follows RFC 3986 component-specific encoding rules.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private EncodingPolicy()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static URIBuilder.EncodingPolicy valueOf​(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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • 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 by PercentCodec.FRAGMENT. This policy ensures compliance with RFC 3986 while maintaining interoperability.
    • Constructor Detail

      • EncodingPolicy

        private EncodingPolicy()
    • 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 name
        java.lang.NullPointerException - if the argument is null