Class URIUtils


  • public final class URIUtils
    extends Object
    Helper class to parse a URI or build one given parameters.
    Author:
    Anahide Tchertchian, Florent Guillaume
    • Method Detail

      • getURIQuery

        public static String getURIQuery​(Map<String,​String> parameters)
        Creates an URI query given the request parameters.
        Returns:
        an URI query given the request parameters.
      • getURIPath

        public static String getURIPath​(String uri)
        Returns an URI path given the uri.
      • getRequestParameters

        public static Map<String,​String> getRequestParameters​(String uriQuery)
        Returns:
        a map with request parameters information given an URI query.
      • quoteURIPathComponent

        public static String quoteURIPathComponent​(String s,
                                                   boolean quoteSlash)
      • quoteURIPathComponent

        public static String quoteURIPathComponent​(String s,
                                                   boolean quoteSlash,
                                                   boolean quoteAt)
        Quotes a URI path component, with ability to quote "/" and "@" characters or not depending on the URI path
        Parameters:
        s - the uri path to quote
        quoteSlash - true if "/" character should be quoted and replaced by %2F
        quoteAt - true if "@" character should be quoted and replaced by %40
        Since:
        5.6
      • quoteURIPathToken

        public static String quoteURIPathToken​(String s)
        Quotes a URI path token. For example, a blob filename. It replaces "/" by "-".
        Parameters:
        s - the uri path token to quote
        Since:
        7.3
      • quoteURIPathComponent

        protected static String quoteURIPathComponent​(String s,
                                                      String slashSequence,
                                                      String atSequence)
        Quotes a URI path component, with ability to quote "/" and "@" characters or not depending on the URI path
        Parameters:
        s - the uri path to quote
        slashSequence - if null, do not quote "/", otherwise, replace "/" by the given sequence
        atSequence - if null, do not quote "@", otherwise, replace "@" by the given sequence
        Since:
        5.6
      • unquoteURIPathComponent

        public static String unquoteURIPathComponent​(String s)