Class URLSignature


  • public class URLSignature
    extends Object
    Utilities to compute a signature for a given URL
    • Constructor Detail

      • URLSignature

        public URLSignature()
    • Method Detail

      • computeQueryStringSignature

        public static int computeQueryStringSignature​(String queryString)

        Computes a signature for a query string which is independent from the way parameters are encoded, or from their order.

        For example the signature for the two following query string will be identical:

        • param+1=value%201¶m%202=value+2
        • param+2=value%202¶m%201=value+1

        Leading question mark on the query string will be ignored.

        Parameters:
        queryString - Query string to compute parameters for
        Returns:
        The signature for the query string
      • canonicaliseQueryStringToBeHashed

        public static String canonicaliseQueryStringToBeHashed​(String queryString)

        Converts a query string into a canonical form that can be used for hashing.

        Known bug: this does suffer some issues like p=2&v=22 would be considered the same as p=22&v=2.

        Parameters:
        queryString -
        Returns: