Package org.jboss.resteasy.util
Class URLUtils
java.lang.Object
org.jboss.resteasy.util.URLUtils
URL-encoding utility for each URL part according to the RFC specs
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BitSet
alpha = lowalpha | upalphastatic final BitSet
alphanum = alpha | digitstatic final BitSet
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"static final BitSet
fragment = pchar / "/" / "?"static final BitSet
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"static final BitSet
lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"static final BitSet
path_param_name = pchar";" | "=" static final BitSet
path_param_value = pchar";" static final BitSet
path_segment = pchar";" static final BitSet
pchar = unreserved | escaped | sub-delims | ":" | "@"static final BitSet
query = pchar / "/" / "?"static final BitSet
reserved = gen-delims | sub-delimsstatic final BitSet
sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="static final BitSet
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"static final BitSet
upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
encodePart
(String part, String charset, BitSet allowed) Encodes a string to be a valid URI part, with the given characters allowed.static String
encodePathParamName
(String pathParamName) Encodes a string to be a valid path parameter name, which means it can contain PCHAR* without "=" or ";".static String
encodePathParamValue
(String pathParamValue) Encodes a string to be a valid path parameter value, which means it can contain PCHAR* without ";".static String
encodePathSegment
(String pathSegment) Encodes a string to be a valid path segment, which means it can contain PCHAR* only (do not put path parameters or they will be escaped.static String
encodeQueryNameOrValue
(String queryNameOrValue) Encodes a string to be a valid query, which means it can contain PCHAR* | "?" | "/" without "=" | "&" | "+".static String
encodeQueryNameOrValueNoParen
(String queryNameOrValueNoParen) Encodes a string to be a valid query with no parenthesis, which means it can contain PCHAR* | "?" | "/" without "=" | "&" | "+" | "(" | ")".
-
Field Details
-
GEN_DELIMS
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" -
SUB_DELIMS
sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" -
RESERVED
reserved = gen-delims | sub-delims -
LOW_ALPHA
lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" -
UP_ALPHA
upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" -
ALPHA
alpha = lowalpha | upalpha -
DIGIT
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" -
ALPHANUM
alphanum = alpha | digit -
UNRESERVED
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" -
PCHAR
pchar = unreserved | escaped | sub-delims | ":" | "@" Note: we don't allow escaped here since we will escape it ourselves, so we don't want to allow them in the unescaped sequences -
PATH_SEGMENT
path_segment = pchar";" -
PATH_PARAM_NAME
path_param_name = pchar";" | "=" -
PATH_PARAM_VALUE
path_param_value = pchar";" -
QUERY
query = pchar / "/" / "?" -
FRAGMENT
fragment = pchar / "/" / "?"
-
-
Constructor Details
-
URLUtils
public URLUtils()
-
-
Method Details
-
encodePathParamName
Encodes a string to be a valid path parameter name, which means it can contain PCHAR* without "=" or ";". Uses UTF-8. -
encodePathParamValue
Encodes a string to be a valid path parameter value, which means it can contain PCHAR* without ";". Uses UTF-8. -
encodeQueryNameOrValue
Encodes a string to be a valid query, which means it can contain PCHAR* | "?" | "/" without "=" | "&" | "+". Uses UTF-8. -
encodeQueryNameOrValueNoParen
Encodes a string to be a valid query with no parenthesis, which means it can contain PCHAR* | "?" | "/" without "=" | "&" | "+" | "(" | ")". It strips parenthesis. Uses UTF-8. -
encodePathSegment
Encodes a string to be a valid path segment, which means it can contain PCHAR* only (do not put path parameters or they will be escaped. Uses UTF-8. -
encodePart
public static String encodePart(String part, String charset, BitSet allowed) throws UnsupportedEncodingException Encodes a string to be a valid URI part, with the given characters allowed. The rest will be encoded.- Throws:
UnsupportedEncodingException
-