Package org.swisspush.gateleen.core.http
Class HeaderFunctions
- java.lang.Object
-
- org.swisspush.gateleen.core.http.HeaderFunctions
-
public class HeaderFunctions extends Object
Helper class to create function chains for (Http) header (seeMultiMap) manipulations function chains can be created programmatically or via JSON config. Apply the function chain on a MultiMap withheaders=chain.apply(headers);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHeaderFunctions.EvalScope
-
Field Summary
Fields Modifier and Type Field Description static HeaderFunctionDO_NOTHING
-
Constructor Summary
Constructors Constructor Description HeaderFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static HeaderFunctionparseFromJson(io.vertx.core.json.JsonArray config)Example configuration (a JSON array):static HeaderFunctionparseStaticHeadersFromJson(io.vertx.core.json.JsonObject staticHeaders)Deprecated.static Consumer<HeaderFunctions.EvalScope>remove(String headerName)static Consumer<HeaderFunctions.EvalScope>setAlways(String headerName, String expression)static Consumer<HeaderFunctions.EvalScope>setIfAbsent(String headerName, String expression)static Consumer<HeaderFunctions.EvalScope>setIfPresent(String headerName, String expression)
-
-
-
Field Detail
-
DO_NOTHING
public static final HeaderFunction DO_NOTHING
-
-
Method Detail
-
parseFromJson
public static HeaderFunction parseFromJson(io.vertx.core.json.JsonArray config) throws IllegalArgumentException
Example configuration (a JSON array):
Notes:[ { "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" } ]- explicit set
to remove a header"value" : null - 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
- explicit set
-
parseStaticHeadersFromJson
@Deprecated public static HeaderFunction parseStaticHeadersFromJson(io.vertx.core.json.JsonObject staticHeaders)
Deprecated.Support for the legacy "staticHeaders" syntax
-
remove
public static Consumer<HeaderFunctions.EvalScope> remove(String headerName)
-
setAlways
public static Consumer<HeaderFunctions.EvalScope> setAlways(String headerName, String expression)
-
setIfAbsent
public static Consumer<HeaderFunctions.EvalScope> setIfAbsent(String headerName, String expression)
-
setIfPresent
public static Consumer<HeaderFunctions.EvalScope> setIfPresent(String headerName, String expression)
-
-