Package org.swisspush.gateleen.core.http
Class HeaderFunctions
- java.lang.Object
-
- org.swisspush.gateleen.core.http.HeaderFunctions
-
public class HeaderFunctions extends java.lang.ObjectHelper 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 java.util.function.Consumer<HeaderFunctions.EvalScope>remove(java.lang.String headerName)static java.util.function.Consumer<HeaderFunctions.EvalScope>setAlways(java.lang.String headerName, java.lang.String expression)static java.util.function.Consumer<HeaderFunctions.EvalScope>setIfAbsent(java.lang.String headerName, java.lang.String expression)static java.util.function.Consumer<HeaderFunctions.EvalScope>setIfPresent(java.lang.String headerName, java.lang.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 java.lang.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:
java.lang.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 java.util.function.Consumer<HeaderFunctions.EvalScope> remove(java.lang.String headerName)
-
setAlways
public static java.util.function.Consumer<HeaderFunctions.EvalScope> setAlways(java.lang.String headerName, java.lang.String expression)
-
setIfAbsent
public static java.util.function.Consumer<HeaderFunctions.EvalScope> setIfAbsent(java.lang.String headerName, java.lang.String expression)
-
setIfPresent
public static java.util.function.Consumer<HeaderFunctions.EvalScope> setIfPresent(java.lang.String headerName, java.lang.String expression)
-
-