public class URISupport
extends java.lang.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 java.net.URI |
applyParameters(java.net.URI uri,
java.util.Map<java.lang.String,java.lang.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 java.net.URI |
applyParameters(java.net.URI uri,
java.util.Map<java.lang.String,java.lang.String> queryParameters,
java.lang.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 java.net.URI |
changeScheme(java.net.URI bindAddr,
java.lang.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(java.lang.String str)
Examine the supplied string and ensure that all parends appear as matching pairs.
|
static java.lang.String |
createQueryString(java.util.Map<java.lang.String,? extends java.lang.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 java.net.URI |
createRemainingURI(java.net.URI originalURI,
java.util.Map<java.lang.String,java.lang.String> params)
Creates a URI from the original URI and the remaining parameters.
|
static java.net.URI |
createURIWithQuery(java.net.URI uri,
java.lang.String query)
Creates a URI with the given query, removing an previous query value from the given URI.
|
static int |
indexOfParenthesisMatch(java.lang.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(java.net.URI uri)
Examine a URI and determine if it is a Composite type or not.
|
static URISupport.CompositeData |
parseComposite(java.net.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 java.util.Map<java.lang.String,java.lang.String> |
parseParameters(java.net.URI uri)
Given a URI parse and extract any URI query options and return them as a Key / Value mapping.
|
static java.util.Map<java.lang.String,java.lang.String> |
parseQuery(java.lang.String uri)
Give a URI break off any URI options and store them in a Key / Value Mapping.
|
static java.net.URI |
removeQuery(java.net.URI uri)
Removes any URI query from the given uri and return a new URI that does not contain the query portion.
|
static java.lang.String |
stripPrefix(java.lang.String value,
java.lang.String prefix)
String the given prefix from the target string and return the result.
|
static java.net.URI |
stripScheme(java.net.URI uri)
Strip a URI of its scheme element.
|
public static java.util.Map<java.lang.String,java.lang.String> parseQuery(java.lang.String uri) throws java.net.URISyntaxException
uri
- The URI whose query should be extracted and processed.java.net.URISyntaxException
public static java.util.Map<java.lang.String,java.lang.String> parseParameters(java.net.URI uri) throws java.net.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.java.net.URISyntaxException
public static java.net.URI applyParameters(java.net.URI uri, java.util.Map<java.lang.String,java.lang.String> queryParameters) throws java.net.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.java.net.URISyntaxException
public static java.net.URI applyParameters(java.net.URI uri, java.util.Map<java.lang.String,java.lang.String> queryParameters, java.lang.String optionPrefix) throws java.net.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.java.net.URISyntaxException
public static java.net.URI removeQuery(java.net.URI uri) throws java.net.URISyntaxException
uri
- The URI whose query value is to be removed.java.net.URISyntaxException
public static java.net.URI createURIWithQuery(java.net.URI uri, java.lang.String query) throws java.net.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.java.net.URISyntaxException
public static URISupport.CompositeData parseComposite(java.net.URI uri) throws java.net.URISyntaxException
uri
- The target URI that should be parsed.java.net.URISyntaxException
public static boolean isCompositeURI(java.net.URI uri)
uri
- The URI that is to be examined.public static int indexOfParenthesisMatch(java.lang.String str, int first) throws java.net.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.java.net.URISyntaxException
- fi the string does not contain a matching parend.public static java.lang.String stripPrefix(java.lang.String value, java.lang.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 java.net.URI stripScheme(java.net.URI uri) throws java.net.URISyntaxException
uri
- The URI whose scheme value should be stripped.java.net.URISyntaxException
public static java.lang.String createQueryString(java.util.Map<java.lang.String,? extends java.lang.Object> options) throws java.net.URISyntaxException
options
- The Mapping that will create the new Query string.java.net.URISyntaxException
public static java.net.URI createRemainingURI(java.net.URI originalURI, java.util.Map<java.lang.String,java.lang.String> params) throws java.net.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.java.net.URISyntaxException
public static java.net.URI changeScheme(java.net.URI bindAddr, java.lang.String scheme) throws java.net.URISyntaxException
bindAddr
- The URI whose scheme value should be altered.scheme
- The new scheme value to use for the returned URI.java.net.URISyntaxException
public static boolean checkParenthesis(java.lang.String str)
str
- The target string to examine.Copyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.