Class HeaderTransformsHelper


  • public final class HeaderTransformsHelper
    extends Object
    Helper class for transforming headers required during signing of headers.
    • Method Detail

      • trimAll

        public static String trimAll​(String value)
        "The Trimall function removes excess white space before and after values, and converts sequential spaces to a single space."

        https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html

        The collapse-whitespace logic is equivalent to:

             value.replaceAll("\\s+", " ")
         
        but does not create a Pattern object that needs to compile the match string; it also prevents us from having to make a Matcher object as well.
      • getCanonicalizedHeaderString

        public static String getCanonicalizedHeaderString​(Map<String,​List<String>> canonicalizedHeaders)