Class HeaderFunctions


  • public class HeaderFunctions
    extends Object
    Helper class to create function chains for (Http) header (see MultiMap) manipulations function chains can be created programmatically or via JSON config. Apply the function chain on a MultiMap with headers=chain.apply(headers);
    • Constructor Detail

      • HeaderFunctions

        public HeaderFunctions()
    • Method Detail

      • parseFromJson

        public static HeaderFunction parseFromJson​(io.vertx.core.json.JsonArray config)
                                            throws IllegalArgumentException
        Example configuration (a JSON array):
         [
             { "header": "xxx"    , "value": "111"                                },
             { "header": "yyy"    , "value": "222"                                },
             { "header": "yyy"    , "value": "333"           , "mode": "complete" },
             { "header": "zzz"    , "value": "444"           , "mode": "override" },
             { "header": "oli"    , "value": "{xxx}-{yyy}"                        },
             { "header": "xxx"    , "value": null                                 },
             { "header": "preSuff", "value": "pre-{yyy}-suff"                     }
           ]
         
         
        Notes:
        • explicit set "value" : null to remove a header
        • mode "complete": set header only if not yet present
        • mode "override" (not overwrite): set header only if already present (i.e. replace it)
        • mode absent (default): set header always, i.e. setting if not yet present, overriding if present
        • use angular braces to reference other header values
        Parameters:
        config - the JSON configuration for the header manipulator chain
        Throws:
        IllegalArgumentException
      • parseStaticHeadersFromJson

        @Deprecated
        public static HeaderFunction parseStaticHeadersFromJson​(io.vertx.core.json.JsonObject staticHeaders)
        Deprecated.
        Support for the legacy "staticHeaders" syntax