Class HttpHeaderUtil


  • public class HttpHeaderUtil
    extends Object
    • Constructor Detail

      • HttpHeaderUtil

        public HttpHeaderUtil()
    • Method Detail

      • removeNonForwardHeaders

        public static <T extends io.vertx.core.MultiMap> T removeNonForwardHeaders​(T headers)

        Removes headers which MUST NOT be forwarded by proxies.

        • This MAY modifies the passed headers.
        • This MAY returns the same (modified) instance as passed.
        Parameters:
        headers - The headers to check.
        See Also:
        RFC 2616 section 14.10
      • getHeaderValue

        @Nullable
        public static <T extends io.vertx.core.MultiMap> String getHeaderValue​(@Nonnull
                                                                               T headers,
                                                                               @Nonnull
                                                                               String headerKey)
        Helper method to find the first occurrence of a http header within the given List of headers.
        Parameters:
        headers - The Map with the header key - value pairs to be evaluated
        headerKey - The key for the header pair we are searching for in the given map. Note that the key searching is non case sensitive.
        Returns:
        The found header value or null if none found
      • hasMatchingHeader

        public static <T extends io.vertx.core.MultiMap> boolean hasMatchingHeader​(@Nonnull
                                                                                   T headers,
                                                                                   @Nonnull
                                                                                   Pattern headersPattern)
        Helper method to check the presence of a http header matching the provided pattern. Every header entry is checked in the format KEY: VALUE
        Parameters:
        headers - The Map with the header key - value pairs to be evaluated
        headersPattern - The pattern to match the headers against.
        Returns:
        True if a matching header was found, false otherwise
      • mergeHeaders

        public static void mergeHeaders​(@Nonnull
                                        io.vertx.core.MultiMap destination,
                                        @Nonnull
                                        io.vertx.core.MultiMap source,
                                        @Nullable
                                        String context)
        Merges headers, makes sure that only one value of all headers ends up in the destination MultiMap. Note: This is not 100% in line with https://www.rfc-editor.org/rfc/rfc7230#section-3.2.2 to be further looked into.
        Parameters:
        context - optional context information to be used for logging purposes, not used for the actual merge