Class HeaderUtils
java.lang.Object
org.openehealth.ipf.platform.camel.ihe.ws.HeaderUtils
Utilities for handling HTTP and SOAP headers in Web Service interactions.
- Author:
- Dmytro Rud
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddOutgoingHttpHeaders(Exchange exchange, String... headers) Adds HTTP headers to an outgoing message.static voidaddOutgoingHttpHeaders(Message message, String... headers) Adds HTTP headers to a message.static voidaddOutgoingSoapHeaders(Exchange exchange, Header... headers) Adds SOAP headers to an outgoing message.static voidaddOutgoingSoapHeaders(Message message, Header... headers) Adds SOAP headers to a message.static <T> TgetHeaders(Map<String, Object> messageContext, String key, boolean useInputMessage, boolean needCreateWhenNotExist, Supplier<T> defaultValueFactory) Returns headers of the message represented by the given context.getIncomingHttpHeaders(Exchange exchange) Extracts HTTP headers from an incoming message.getIncomingHttpHeaders(Message message) Extracts HTTP headers from a message.getIncomingSoapHeaders(Exchange exchange) Extracts SOAP headers from an incoming message.getIncomingSoapHeaders(Message message) Extracts SOAP headers from a message.static voidprocessIncomingHeaders(Map<String, Object> messageContext, Message message) static voidprocessUserDefinedOutgoingHeaders(Map<String, Object> messageContext, Message message, boolean isRequest)
-
Method Details
-
processIncomingHeaders
-
processUserDefinedOutgoingHeaders
-
getHeaders
public static <T> T getHeaders(Map<String, Object> messageContext, String key, boolean useInputMessage, boolean needCreateWhenNotExist, Supplier<T> defaultValueFactory) Returns headers of the message represented by the given context.- Type Parameters:
T- type of headers' container.- Parameters:
messageContext- Web Service message context.key- key under which the headers reside in the message context.useInputMessage- whether input message should the used.needCreateWhenNotExist- whether the headers' map should be created when it does not exist.defaultValueFactory- factory for producing default values.- Returns:
- either the map of HTTP headers as found in the message context,
or a newly created map when none found, or
nullwhen creation of a new map is not allowed.
-
getIncomingHttpHeaders
-
getIncomingHttpHeaders
-
getIncomingSoapHeaders
-
getIncomingSoapHeaders
-
addOutgoingHttpHeaders
-
addOutgoingHttpHeaders
Adds HTTP headers to an outgoing message.- Parameters:
exchange- Camel exchange containing the message.headers- varargs containing names and values of the headers to add, e.g."X-MyHeader1", "12345", "X-MyHeader2", "tralala".
-
addOutgoingSoapHeaders
-
addOutgoingSoapHeaders
-