Class UriComponent
java.lang.Object
org.exoplatform.services.rest.impl.uri.UriComponent
- Version:
- $Id: $
- Author:
- Andrey Parfonov
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFragment.static final intHost URI component.static final intPath URI components, consists of path-segments.static final intPath segment URI sub-component, it can't contains '/'.static final intPort URI component.static final intQuery string.static final intScheme URI component.static final intScheme-specific part.static final intUserInfo URI component. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckHexCharacters(String s, int p) Check does two next characters after '%' represent percent-encoded character.static StringDecode percent encoded URI string.static StringEncode given URI string.static List<javax.ws.rs.core.PathSegment> parsePathSegments(String path, boolean decode) Parse path segments.parseQueryString(String rawQuery, boolean decode) Parse encoded query string.static StringrecognizeEncode(String str, int component, boolean containsUriParams) Check string and if it does not contains any '%' characters validate it for contains only valid characters.static StringValidate content of percent-encoding string.
-
Field Details
-
SCHEME
public static final int SCHEMEScheme URI component.- See Also:
-
USER_INFO
public static final int USER_INFOUserInfo URI component.- See Also:
-
HOST
public static final int HOSTHost URI component.- See Also:
-
PORT
public static final int PORTPort URI component.- See Also:
-
PATH_SEGMENT
public static final int PATH_SEGMENTPath segment URI sub-component, it can't contains '/'.- See Also:
-
PATH
public static final int PATHPath URI components, consists of path-segments.- See Also:
-
QUERY
public static final int QUERYQuery string.- See Also:
-
FRAGMENT
public static final int FRAGMENTFragment.- See Also:
-
SSP
public static final int SSPScheme-specific part.- See Also:
-
-
Method Details
-
encode
Encode given URI string.- Parameters:
str- the URI stringcomponent- component of URI, scheme, host, port, etccontainsUriParams- true if the source string contains URI parameters- Returns:
- encoded string
-
validate
Validate content of percent-encoding string.- Parameters:
str- the string which must be validatecomponent- component of URI, scheme, host, port, etccontainsUriParams- true if the source string contains URI parameters- Returns:
- the source string
-
recognizeEncode
Check string and if it does not contains any '%' characters validate it for contains only valid characters. If it contains '%' then check does following two character is valid hex numbers, if not then encode '%' to '%25' otherwise keep characters without change, there is no double encoding.- Parameters:
str- source stringcomponent- part of URI, e. g. schema, host, pathcontainsUriParams- does string may contains URI templates- Returns:
- valid string
-
decode
Decode percent encoded URI string.- Parameters:
str- the source percent encoded stringcomponent- component of URI, scheme, host, port, etc. NOTE type of component is not used currently but will be used for decoding IPv6 addresses- Returns:
- decoded string
-
checkHexCharacters
Check does two next characters after '%' represent percent-encoded character.- Parameters:
s- source stringp- position of character in string- Returns:
- true is two characters after '%' represent percent-encoded character false otherwise
-
parsePathSegments
Parse path segments.- Parameters:
path- the relative pathdecode- true if character must be decoded false otherwise- Returns:
- List of
PathSegment
-
parseQueryString
public static javax.ws.rs.core.MultivaluedMap<String,String> parseQueryString(String rawQuery, boolean decode) Parse encoded query string.- Parameters:
rawQuery- source query stringdecode- if true then query parameters will be decoded- Returns:
MultivaluedMapwith query parameters
-