public final class URISupport extends Object
Modifier and Type | Field and Description |
---|---|
static String |
RAW_TOKEN_END |
static String |
RAW_TOKEN_START |
Modifier and Type | Method and Description |
---|---|
static String |
createQueryString(Map<String,String> options,
String ampersand,
boolean encode)
Assembles a query from the given map.
|
static Map<String,Object> |
extractProperties(Map<String,Object> properties,
String optionPrefix) |
static boolean |
isEmpty(Object value)
Tests whether the value is null or an empty string.
|
static boolean |
isNotEmpty(Object value)
Tests whether the value is not null or an empty string.
|
static URI |
normalizeUri(String uri)
Normalizes the URI so unsafe characters is encoded
|
static Map<String,Object> |
parseParameters(URI uri)
Parses the query parameters of the uri (eg the query part).
|
static Map<String,Object> |
parseQuery(String uri)
Parses the query part of the uri (eg the parameters).
|
static Map<String,Object> |
parseQuery(String uri,
boolean useRaw)
Parses the query part of the uri (eg the parameters).
|
static String |
stripPrefix(String value,
String prefix)
Strips the prefix from the value.
|
static String |
stripQuery(String uri)
Strips the query parameters from the uri
|
public static final String RAW_TOKEN_START
public static final String RAW_TOKEN_END
public static URI normalizeUri(String uri) throws URISyntaxException
uri
- the input uriURISyntaxException
- is thrown if syntax error in the input uripublic static Map<String,Object> extractProperties(Map<String,Object> properties, String optionPrefix)
public static String stripQuery(String uri)
uri
- the uripublic static Map<String,Object> parseParameters(URI uri) throws URISyntaxException
uri
- the uriURISyntaxException
- is thrown if uri has invalid syntax.public static String stripPrefix(String value, String prefix)
value
- the valueprefix
- the prefix to remove from valuepublic static Map<String,Object> parseQuery(String uri) throws URISyntaxException
uri
- the uriURISyntaxException
- is thrown if uri has invalid syntax.RAW_TOKEN_START
,
RAW_TOKEN_END
public static Map<String,Object> parseQuery(String uri, boolean useRaw) throws URISyntaxException
uri
- the uriuseRaw
- whether to force using raw valuesURISyntaxException
- is thrown if uri has invalid syntax.RAW_TOKEN_START
,
RAW_TOKEN_END
public static String createQueryString(Map<String,String> options, String ampersand, boolean encode) throws URISyntaxException
options
- the map with the options (eg key/value pairs)ampersand
- to use & for Java code, and & for XMLURISyntaxException
- is thrown if uri has invalid syntax.public static boolean isEmpty(Object value)
value
- the value, if its a String it will be tested for text length as wellpublic static boolean isNotEmpty(Object value)
value
- the value, if its a String it will be tested for text length as wellApache Camel