Package org.apache.camel.component.cxf
Class DefaultCxfBinding
- java.lang.Object
-
- org.apache.camel.component.cxf.DefaultCxfBinding
-
- All Implemented Interfaces:
CxfBinding
,org.apache.camel.spi.HeaderFilterStrategyAware
public class DefaultCxfBinding extends Object implements CxfBinding, org.apache.camel.spi.HeaderFilterStrategyAware
The Default CXF binding implementation.
-
-
Constructor Summary
Constructors Constructor Description DefaultCxfBinding()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static void
addNamespace(Element element, Map<String,String> nsMap)
void
copyJaxWsContext(org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> context)
Copy the javax.xml.ws* headers into cxfExchange's outMessage, if the cxfExchange has no outMessage, skip this copyprotected void
extractInvocationContextFromCamel(org.apache.camel.Exchange camelExchange, Map<String,Object> camelHeaders, Map<String,Object> cxfContext, String contextKey)
void
extractJaxWsContext(org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> context)
Extract the message headers which key are start from javax.xml.ws* from the CXF exchange's inMessage, and put these headers into the contextstatic Method
findMethod(Class<?> cls, String name, Class<?>... params)
static Object
getBodyFromCamel(org.apache.camel.Message out, DataFormat dataFormat)
protected static Object
getContentFromCxf(org.apache.cxf.message.Message message, DataFormat dataFormat, String encoding)
protected String
getContentTypeString(List<String> values)
org.apache.camel.spi.HeaderFilterStrategy
getHeaderFilterStrategy()
protected static List<Source>
getPayloadBodyElements(org.apache.cxf.message.Message message, Map<String,String> nsMap)
protected org.apache.cxf.message.MessageContentsList
getResponsePayloadList(org.apache.cxf.message.Exchange exchange, List<Source> elements)
void
populateCxfHeaderFromCamelExchangeBeforeCheckError(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange)
This method is called byCxfConsumer
to populate a CXF response protocol headers from a Camel exchange headers before CheckError.void
populateCxfRequestFromExchange(org.apache.cxf.message.Exchange cxfExchange, org.apache.camel.Exchange camelExchange, Map<String,Object> requestContext)
This method is called byCxfProducer.process(Exchange)
.void
populateCxfResponseFromExchange(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange)
This method is called byCxfConsumer
to populate a CXF response exchange from a Camel exchange.void
populateExchangeFromCxfRequest(org.apache.cxf.message.Exchange cxfExchange, org.apache.camel.Exchange camelExchange)
This method is called byCxfConsumer
.void
populateExchangeFromCxfResponse(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> responseContext)
This method is called byCxfProducer.process(Exchange)
.protected void
propagateHeadersFromCamelToCxf(org.apache.camel.Exchange camelExchange, Map<String,Object> camelHeaders, org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> cxfContext)
protected void
propagateHeadersFromCxfToCamel(org.apache.cxf.message.Message cxfMessage, org.apache.camel.Message camelMessage, org.apache.camel.Exchange exchange)
protected String
replaceMultiPartContentType(String contentType)
protected void
setCharsetWithContentType(org.apache.camel.Exchange camelExchange)
void
setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy strategy)
-
-
-
Method Detail
-
populateCxfRequestFromExchange
public void populateCxfRequestFromExchange(org.apache.cxf.message.Exchange cxfExchange, org.apache.camel.Exchange camelExchange, Map<String,Object> requestContext)
This method is called byCxfProducer.process(Exchange)
. It populates the CXF exchange and invocation context (i.e. request/response) contexts, it but does not create and populate a CXF message as a ClientImpl's invoke method will create a new CXF Message. That method will put all properties from the CXF exchange and request context to the CXF message.- Specified by:
populateCxfRequestFromExchange
in interfaceCxfBinding
- Parameters:
cxfExchange
- exchange to be populatedcamelExchange
- exchange that contains a requestrequestContext
- a map contains request contexts. This parameter must not be null. The Client.invoke() method does not allow caller to pass in a CXF Message. The request context are copied to the CXF Message by the Client.invoke() method. This is how caller can set properties on the CXF message.
-
populateExchangeFromCxfResponse
public void populateExchangeFromCxfResponse(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> responseContext)
This method is called byCxfProducer.process(Exchange)
. It propagates information from CXF Exchange to Camel Exchange. The CXF Exchange contains a request from a CXF server.- Specified by:
populateExchangeFromCxfResponse
in interfaceCxfBinding
- Parameters:
camelExchange
- exchanged to be populatedcxfExchange
- exchange that contains a responseresponseContext
- map contains response context from CXF
-
populateExchangeFromCxfRequest
public void populateExchangeFromCxfRequest(org.apache.cxf.message.Exchange cxfExchange, org.apache.camel.Exchange camelExchange)
This method is called byCxfConsumer
.- Specified by:
populateExchangeFromCxfRequest
in interfaceCxfBinding
- Parameters:
cxfExchange
- CXF exchange that contains a requestcamelExchange
- Camel exchange to be populated
-
populateCxfHeaderFromCamelExchangeBeforeCheckError
public void populateCxfHeaderFromCamelExchangeBeforeCheckError(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange)
This method is called byCxfConsumer
to populate a CXF response protocol headers from a Camel exchange headers before CheckError. Ensure can send protocol headers back even error/exception thrown
-
populateCxfResponseFromExchange
public void populateCxfResponseFromExchange(org.apache.camel.Exchange camelExchange, org.apache.cxf.message.Exchange cxfExchange)
This method is called byCxfConsumer
to populate a CXF response exchange from a Camel exchange.- Specified by:
populateCxfResponseFromExchange
in interfaceCxfBinding
- Parameters:
camelExchange
- Camel exchange that contains an out messagecxfExchange
- CXF exchange to be populated
-
setCharsetWithContentType
protected void setCharsetWithContentType(org.apache.camel.Exchange camelExchange)
-
getHeaderFilterStrategy
public org.apache.camel.spi.HeaderFilterStrategy getHeaderFilterStrategy()
- Specified by:
getHeaderFilterStrategy
in interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
setHeaderFilterStrategy
public void setHeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy strategy)
- Specified by:
setHeaderFilterStrategy
in interfaceorg.apache.camel.spi.HeaderFilterStrategyAware
-
getResponsePayloadList
protected org.apache.cxf.message.MessageContentsList getResponsePayloadList(org.apache.cxf.message.Exchange exchange, List<Source> elements)
-
extractInvocationContextFromCamel
protected void extractInvocationContextFromCamel(org.apache.camel.Exchange camelExchange, Map<String,Object> camelHeaders, Map<String,Object> cxfContext, String contextKey)
- Parameters:
camelExchange
-cxfContext
- Request or Response contextcamelHeaders
-contextKey
-
-
propagateHeadersFromCxfToCamel
protected void propagateHeadersFromCxfToCamel(org.apache.cxf.message.Message cxfMessage, org.apache.camel.Message camelMessage, org.apache.camel.Exchange exchange)
- Parameters:
cxfMessage
-camelMessage
-exchange
- provides context for filtering
-
propagateHeadersFromCamelToCxf
protected void propagateHeadersFromCamelToCxf(org.apache.camel.Exchange camelExchange, Map<String,Object> camelHeaders, org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> cxfContext)
-
getContentFromCxf
protected static Object getContentFromCxf(org.apache.cxf.message.Message message, DataFormat dataFormat, String encoding)
-
getPayloadBodyElements
protected static List<Source> getPayloadBodyElements(org.apache.cxf.message.Message message, Map<String,String> nsMap)
-
getBodyFromCamel
public static Object getBodyFromCamel(org.apache.camel.Message out, DataFormat dataFormat)
-
copyJaxWsContext
public void copyJaxWsContext(org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> context)
Description copied from interface:CxfBinding
Copy the javax.xml.ws* headers into cxfExchange's outMessage, if the cxfExchange has no outMessage, skip this copy
- Specified by:
copyJaxWsContext
in interfaceCxfBinding
- Parameters:
cxfExchange
- CXF exchange to be populatedcontext
- The map which used to store the message headers
-
extractJaxWsContext
public void extractJaxWsContext(org.apache.cxf.message.Exchange cxfExchange, Map<String,Object> context)
Description copied from interface:CxfBinding
Extract the message headers which key are start from javax.xml.ws* from the CXF exchange's inMessage, and put these headers into the context
- Specified by:
extractJaxWsContext
in interfaceCxfBinding
- Parameters:
cxfExchange
- CXF exchange to be populatedcontext
- The map which used to store the message headers
-
-