Class ZoneIdSupport
java.lang.Object
org.apache.hc.core5.net.ZoneIdSupport
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanappendBracketedIPv6(StringBuilder buf, CharSequence host) Appends a bracketed IPv6 literal tobufifhostlooks like IPv6.static StringdecodeZoneId(CharSequence host) RFC 6874 decoder for bracket contents of an IPv6 literal.static StringRFC 6874 encoder for ZoneID: emits unreserved characters as-is and percent-encodes everything else using UTF-8 with UPPERCASE hex digits.static booleanHeuristic: returnstrueifhostlooks like an IPv6 address-part (i.e., before any ZoneID) by counting colons.private static booleanunreserved(char ch) RFC 3986 unreserved characters.static voidRFC 6874 ZoneID validator:
-
Constructor Details
-
ZoneIdSupport
private ZoneIdSupport()
-
-
Method Details
-
encodeZoneIdRfc6874
RFC 6874 encoder for ZoneID: emits unreserved characters as-is and percent-encodes everything else using UTF-8 with UPPERCASE hex digits. Existing %HH triplets are passed through unchanged. -
decodeZoneId
RFC 6874 decoder for bracket contents of an IPv6 literal. Input:"addr%25<enc-zone>"→ Output internal form:"addr%<decoded-zone>". If there is no"%25"delimiter, returns the input as-is. -
validateZoneIdEncoded
RFC 6874 ZoneID validator:ZoneID = 1*( unreserved / pct-encoded )
ThrowsIllegalArgumentExceptionon invalid input. -
looksLikeIPv6AddressPart
Heuristic: returnstrueifhostlooks like an IPv6 address-part (i.e., before any ZoneID) by counting colons. We do not parse/validate IPv6; this keeps our surface minimal while still bracketing correctly.Rule: if the address-part (up to '%', if present) contains >= 2 colons, treat it as IPv6-like.
-
appendBracketedIPv6
Appends a bracketed IPv6 literal tobufifhostlooks like IPv6. If a ZoneID is present (after '%'), it is written as"%25"followed by the RFC 6874-encoded ZoneID. Returnstrueiff it wrote the bracketed literal. -
unreserved
private static boolean unreserved(char ch) RFC 3986 unreserved characters.
-