public class URISupport extends Object
Modifier and Type | Class and Description |
---|---|
static class |
URISupport.CompositeData
A composite URI can be split into one or more CompositeData object which each represent the
individual URIs that comprise the composite one.
|
Constructor and Description |
---|
URISupport() |
Modifier and Type | Method and Description |
---|---|
static URI |
applyParameters(URI uri,
Map<String,String> queryParameters)
Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the
newly updated URI that contains the value of the given URI and the appended query value.
|
static URI |
applyParameters(URI uri,
Map<String,String> queryParameters,
String optionPrefix)
Given a Key / Value mapping create and append a URI query value that represents the mapped entries, return the
newly updated URI that contains the value of the given URI and the appended query value.
|
static URI |
changeScheme(URI bindAddr,
String scheme)
Given a URI value create and return a new URI that matches the target one but with the scheme value
supplied to this method.
|
static boolean |
checkParenthesis(String str)
Examine the supplied string and ensure that all parends appear as matching pairs.
|
static String |
createQueryString(Map<String,? extends Object> options)
Given a key / value mapping, create and return a URI formatted query string that is valid and
can be appended to a URI.
|
static URI |
createRemainingURI(URI originalURI,
Map<String,String> params)
Creates a URI from the original URI and the remaining parameters.
|
static URI |
createURIWithQuery(URI uri,
String query)
Creates a URI with the given query, removing an previous query value from the given URI.
|
static int |
indexOfParenthesisMatch(String str,
int first)
Given a string and a position in that string of an open parend, find the matching close parend.
|
static boolean |
isCompositeURI(URI uri)
Examine a URI and determine if it is a Composite type or not.
|
static URISupport.CompositeData |
parseComposite(URI uri)
Given a composite URI, parse the individual URI elements contained within that URI and return
a CompsoteData instance that contains the parsed URI values.
|
static Map<String,String> |
parseParameters(URI uri)
Given a URI parse and extract any URI query options and return them as a Key / Value mapping.
|
static Map<String,String> |
parseQuery(String uri)
Give a URI break off any URI options and store them in a Key / Value Mapping.
|
static URI |
removeQuery(URI uri)
Removes any URI query from the given uri and return a new URI that does not contain the query portion.
|
static String |
stripPrefix(String value,
String prefix)
String the given prefix from the target string and return the result.
|
static URI |
stripScheme(URI uri)
Strip a URI of its scheme element.
|
public static Map<String,String> parseQuery(String uri) throws URISyntaxException
uri
- The URI whose query should be extracted and processed.URISyntaxException
public static Map<String,String> parseParameters(URI uri) throws URISyntaxException
parseQuery
method in that it handles composite URI types and
will extract the URI options from the outermost composite URI.uri
- The URI whose query should be extracted and processed.URISyntaxException
public static URI applyParameters(URI uri, Map<String,String> queryParameters) throws URISyntaxException
uri
- The source URI that will have the Map entries appended as a URI query value.queryParameters
- The Key / Value mapping that will be transformed into a URI query string.URISyntaxException
public static URI applyParameters(URI uri, Map<String,String> queryParameters, String optionPrefix) throws URISyntaxException
uri
- The source URI that will have the Map entries appended as a URI query value.queryParameters
- The Key / Value mapping that will be transformed into a URI query string.optionPrefix
- A string value that when not null or empty is used to prefix each query option key.URISyntaxException
public static URI removeQuery(URI uri) throws URISyntaxException
uri
- The URI whose query value is to be removed.URISyntaxException
public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException
uri
- The source URI whose existing query is replaced with the newly supplied one.query
- The new URI query string that should be appended to the given URI.URISyntaxException
public static URISupport.CompositeData parseComposite(URI uri) throws URISyntaxException
uri
- The target URI that should be parsed.URISyntaxException
public static boolean isCompositeURI(URI uri)
uri
- The URI that is to be examined.public static int indexOfParenthesisMatch(String str, int first) throws URISyntaxException
str
- The string to be searched for a matching parend.first
- The index in the string of the opening parend whose close value is to be searched.URISyntaxException
- fi the string does not contain a matching parend.public static String stripPrefix(String value, String prefix)
value
- The string that should be trimmed of the given prefix if present.prefix
- The prefix to remove from the target string.public static URI stripScheme(URI uri) throws URISyntaxException
uri
- The URI whose scheme value should be stripped.URISyntaxException
public static String createQueryString(Map<String,? extends Object> options) throws URISyntaxException
options
- The Mapping that will create the new Query string.URISyntaxException
public static URI createRemainingURI(URI originalURI, Map<String,String> params) throws URISyntaxException
originalURI
- The URI whose current parameters are remove and replaced with the given remainder value.params
- The URI params that should be used to replace the current ones in the target.URISyntaxException
public static URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException
bindAddr
- The URI whose scheme value should be altered.scheme
- The new scheme value to use for the returned URI.URISyntaxException
public static boolean checkParenthesis(String str)
str
- The target string to examine.Copyright © 2017 JBoss by Red Hat. All rights reserved.