Class URIUtils

java.lang.Object
org.mapfish.print.URIUtils

public final class URIUtils extends Object
Utility methods for editing and analyzing uris.
  • Method Details

    • getParameters

      public static com.google.common.collect.Multimap<String,String> getParameters(URI uri)
      Parse the URI and get all the parameters in map form. Query name -> List of Query values.
      Parameters:
      uri - uri to analyze
    • getParameters

      public static com.google.common.collect.Multimap<String,String> getParameters(String rawQuery)
      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 URISyntaxException
      Add the given params to the query.
      Parameters:
      url - The query
      params - The params to add
      overrideParams - 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 query
      params - The params to add
      overrideParams - 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 parameters
      key - the key/param name
      value - 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 parameters
      key - the key/param name
      value - 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 URI
      queryParams - 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

      public static URI setPath(URI initialUri, String path)
      Set the replace of the uri and return the new URI.
      Parameters:
      initialUri - the starting URI, the URI to update
      path - the path to set on the baeURI