Package org.keycloak.common.util
Class Encode
java.lang.Object
org.keycloak.common.util.Encode
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static MultivaluedHashMap<String,
String> decode
(MultivaluedHashMap<String, String> map) decode an encoded mapstatic MultivaluedHashMap<String,
String> decode
(MultivaluedHashMap<String, String> map, String charset) decode an encoded mapstatic String
decodePath
(String path) static MultivaluedHashMap<String,
String> encode
(MultivaluedHashMap<String, String> map) static String
encodeFragment
(String value) Keep encoded values "%..." and template parameters intact.static String
encodeFragmentAsIs
(String nameOrValue) static String
Keep encoded values "%..." but not the template parameters.protected static String
encodeFromArray
(String segment, String[] encodingMap, boolean encodePercent) static String
encodeMatrixParam
(String value) Keep encoded values "%..." and template parameters intact.static String
encodeNonCodes
(String string) Encode '%' if it is not an encoding sequencestatic String
encodePath
(String value) Keep encoded values "%...", matrix parameters, template parameters, and '/' characters intact.static String
encodePathAsIs
(String segment) Encode via RFC 3986.static String
encodePathSaveEncodings
(String segment) Keep any valid encodings from string i.e.static String
encodePathSegment
(String value) Keep encoded values "%...", matrix parameters and template parameters intact.static String
encodePathSegmentAsIs
(String segment) Encode via RFC 3986.static String
encodePathSegmentSaveEncodings
(String segment) Keep any valid encodings from string i.e.static String
encodeQueryParam
(String value) Keep encoded values "%..." and template parameters intact.static String
encodeQueryParamAsIs
(String nameOrValue) Encodes everything of a query parameter name or value.static String
encodeQueryParamSaveEncodings
(String segment) Keep any valid encodings from string i.e.static String
encodeQueryString
(String value) Keep encoded values "%..." and template parameters intact.static String
Keep encoded values "%..." but not the template parameters.static String
encodeUserInfo
(String value) Keep encoded values "%..." and template parameters intact.static String
encodeUserInfoAsIs
(String nameOrValue) Encodes everything in user-infostatic String
Keep encoded values "%..." but not the template parameters.static String
encodeUserInfoSaveEncodings
(String segment) Keep any valid encodings from string i.e.static String
encodeValue
(String segment, String[] encoding) Keep encoded values "%..." and template parameters intact i.e.static String
pathParamReplacement
(String segment, List<String> params) static boolean
savePathParams
(String segment, StringBuilder newSegment, List<String> params) static String
static String
-
Constructor Details
-
Encode
public Encode()
-
-
Method Details
-
encodeQueryString
Keep encoded values "%..." and template parameters intact. -
encodeQueryStringNotTemplateParameters
Keep encoded values "%..." but not the template parameters.- Parameters:
value
-- Returns:
-
encodeUserInfo
Keep encoded values "%..." and template parameters intact.- Parameters:
value
- The user-info value to encode- Returns:
- The user-info encoded
-
encodeUserInfoNotTemplateParameters
Keep encoded values "%..." but not the template parameters.- Parameters:
value
- The user-info to encode- Returns:
- The user-info encoded
-
encodePath
Keep encoded values "%...", matrix parameters, template parameters, and '/' characters intact. -
encodePathSegment
Keep encoded values "%...", matrix parameters and template parameters intact. -
encodeFragment
Keep encoded values "%..." and template parameters intact. -
encodeFragmentNotTemplateParameters
Keep encoded values "%..." but not the template parameters.- Parameters:
value
-- Returns:
-
encodeMatrixParam
Keep encoded values "%..." and template parameters intact. -
encodeQueryParam
Keep encoded values "%..." and template parameters intact. -
decodePath
-
encodeNonCodes
Encode '%' if it is not an encoding sequence- Parameters:
string
-- Returns:
-
savePathParams
-
encodeValue
Keep encoded values "%..." and template parameters intact i.e. "{x}"- Parameters:
segment
-encoding
-- Returns:
-
encodePathAsIs
Encode via RFC 3986. PCHAR is allowed along with '/' unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" pchar = unreserved / pct-encoded / sub-delims / ":" / "@" -
encodePathSaveEncodings
Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"- Parameters:
segment
-- Returns:
-
encodePathSegmentAsIs
Encode via RFC 3986. PCHAR is allowed along with '/' unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" pchar = unreserved / pct-encoded / sub-delims / ":" / "@" -
encodePathSegmentSaveEncodings
Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"- Parameters:
segment
-- Returns:
-
encodeQueryParamAsIs
Encodes everything of a query parameter name or value.- Parameters:
nameOrValue
-- Returns:
-
encodeQueryParamSaveEncodings
Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"- Parameters:
segment
-- Returns:
-
encodeUserInfoAsIs
Encodes everything in user-info- Parameters:
nameOrValue
-- Returns:
-
encodeUserInfoSaveEncodings
Keep any valid encodings from string i.e. keep "%2D" but don't keep "%p"- Parameters:
segment
-- Returns:
-
encodeFragmentAsIs
-
encodeFromArray
-
pathParamReplacement
-
decode
decode an encoded map- Parameters:
map
-- Returns:
-
decode
public static MultivaluedHashMap<String,String> decode(MultivaluedHashMap<String, String> map, String charset) decode an encoded map- Parameters:
map
-charset
-- Returns:
-
encode
-
decode
-
urlEncode
- Parameters:
string
-- Returns:
- URL encoded input
-
urlDecode
- Parameters:
string
-- Returns:
- URL decoded input
-