Package org.mapfish.print
Class URIUtils
java.lang.Object
org.mapfish.print.URIUtils
Utility methods for editing and analyzing uris.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddParamOverride(com.google.common.collect.Multimap<String, String> params, String key, String value) Add a parameter to the query params (the params map) replacing any parameter that might be there.static StringaddParams(String url, com.google.common.collect.Multimap<String, String> params, Set<String> overrideParams) Add the given params to the query.static URIaddParams(URI uri, com.google.common.collect.Multimap<String, String> params, Set<String> overrideParams) Add the given params to the query.getParameters(String rawQuery) Parse the URI and get all the parameters in map form.getParameters(URI uri) Parse the URI and get all the parameters in map form.static voidsetParamDefault(com.google.common.collect.Multimap<String, String> params, String key, String value) Add a parameter to the query params (the params map) if there is not existing value for that key.static URISet the replace of the uri and return the new URI.static URIsetQueryParams(URI initialUri, com.google.common.collect.Multimap<String, String> queryParams) Construct a new uri by replacing query parameters in initialUri with the query parameters provided.static StringtoString(MfClientHttpRequestFactory requestFactory, URI uri) Read all the data from the provided URI and return the data as a string.static StringtoString(MfClientHttpRequestFactory requestFactory, URL url) Read all the data from the provided URI and return the data as a string.
-
Method Details
-
getParameters
Parse the URI and get all the parameters in map form. Query name -> List of Query values.- Parameters:
uri- uri to analyze
-
getParameters
Parse the URI and get all the parameters in map form. Query name -> List of Query values.- Parameters:
rawQuery- query portion of the uri to analyze.
-
addParams
public static String addParams(String url, com.google.common.collect.Multimap<String, String> params, Set<String> overrideParams) throws URISyntaxExceptionAdd the given params to the query.- Parameters:
url- The queryparams- The params to addoverrideParams- A set of parameter names that must be overridden and not added- Returns:
- The new query
- Throws:
URISyntaxException
-
addParams
public static URI addParams(URI uri, com.google.common.collect.Multimap<String, String> params, Set<String> overrideParams) Add the given params to the query.- Parameters:
uri- The queryparams- The params to addoverrideParams- A set of parameter names that must be overridden and not added- Returns:
- The new query
-
addParamOverride
public static void addParamOverride(com.google.common.collect.Multimap<String, String> params, String key, String value) Add a parameter to the query params (the params map) replacing any parameter that might be there.- Parameters:
params- the query parameterskey- the key/param namevalue- the value to insert
-
setParamDefault
public static void setParamDefault(com.google.common.collect.Multimap<String, String> params, String key, String value) Add a parameter to the query params (the params map) if there is not existing value for that key.- Parameters:
params- the query parameterskey- the key/param namevalue- the value to insert
-
setQueryParams
public static URI setQueryParams(URI initialUri, com.google.common.collect.Multimap<String, String> queryParams) Construct a new uri by replacing query parameters in initialUri with the query parameters provided.- Parameters:
initialUri- the initial/template URIqueryParams- the new query parameters.
-
toString
public static String toString(MfClientHttpRequestFactory requestFactory, URI uri) throws IOException Read all the data from the provided URI and return the data as a string.- Parameters:
requestFactory- Request factory for making the request.uri- the uri to load data from.- Returns:
- the data in string form.
- Throws:
IOException
-
toString
public static String toString(MfClientHttpRequestFactory requestFactory, URL url) throws IOException Read all the data from the provided URI and return the data as a string.- Parameters:
requestFactory- Request factory for making the request.url- the uri to load data from.- Returns:
- the data in string form.
- Throws:
IOException
-
setPath
Set the replace of the uri and return the new URI.- Parameters:
initialUri- the starting URI, the URI to updatepath- the path to set on the baeURI
-