Package io.constructor.client
Class OkHttpUrlBuilderUtils
java.lang.Object
io.constructor.client.OkHttpUrlBuilderUtils
Utility file that contains code paths from
https://square.github.io/okhttp/4.x/okhttp/okhttp3/-http-url/-builder/ that were otherwise
unaccessible. Line for line copy of the code needed to canonicalize URLs and define how plus
signs are encoded.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
canonicalize
(String input, int pos, int limit, String encodeSet, boolean alreadyEncoded, boolean strict, boolean plusIsSpace, boolean asciiOnly, Charset charset) Returns a substring ofinput
on the range[pos..limit)
with the following transformations: Tabs, newlines, form feeds and carriage returns are skipped.static int
decodeHexDigit
(char c) static boolean
percentEncoded
(String encoded, int pos, int limit)
-
Field Details
-
HEX_DIGITS
public static final char[] HEX_DIGITS -
PATH_SEGMENT_ENCODE_SET
- See Also:
-
-
Constructor Details
-
OkHttpUrlBuilderUtils
public OkHttpUrlBuilderUtils()
-
-
Method Details
-
decodeHexDigit
public static int decodeHexDigit(char c) -
percentEncoded
-
canonicalize
public static String canonicalize(String input, int pos, int limit, String encodeSet, boolean alreadyEncoded, boolean strict, boolean plusIsSpace, boolean asciiOnly, Charset charset) Returns a substring ofinput
on the range[pos..limit)
with the following transformations:- Tabs, newlines, form feeds and carriage returns are skipped.
- In queries, ' ' is encoded to '+' and '+' is encoded to "%2B".
- Characters in
encodeSet
are percent-encoded. - Control characters and non-ASCII characters are percent-encoded.
- All other characters are copied without transformation.
- Parameters:
alreadyEncoded
- true to leave '%' as-is; false to convert it to '%25'.strict
- true to encode '%' if it is not the prefix of a valid percent encoding.plusIsSpace
- true to encode '+' as "%2B" if it is not already encoded.asciiOnly
- true to encode all non-ASCII codepoints.charset
- which charset to use, null equals UTF-8.
-