|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.component.cxf.jaxrs.DefaultCxfRsBinding
org.apache.camel.component.cxf.jaxrs.SimpleCxfRsBinding
public class SimpleCxfRsBinding
A CXF RS Binding which maps method parameters as Camel IN headers and the payload as the IN message body. It replaces the default behaviour of creating a MessageContentsList, which requires the route to process the contents low-level.
The mapping from CXF to Camel is performed as follows:MessageContentsList is preserved as the message body.MessageContentsList is
preserved as the message body.MessageContentsList.
public Response doAction(BusinessObject request, @HeaderParam("abcd") String abcd, @QueryParam("defg") String defg);MessageContentsList.
Both request params mapped as IN message headers with names abcd and defg.
public Response doAction(@HeaderParam("abcd") String abcd, @QueryParam("defg") String defg);MessageContentsList is preserved, even though it only contains the 2 parameters.
public Response doAction(@Multipart(value="body1", type="application/json") BusinessObject request, @Multipart(value="image",
type="image/jpeg") DataHandler image);MessageContentsList handed over from CXF.
public Response doAction(InputStream abcd);MessageContentsList and preserved as the IN message body.
public Response doAction(DataHandler abcd);MessageContentsList and preserved as the IN message body.
| Nested Class Summary | |
|---|---|
protected static class |
SimpleCxfRsBinding.MethodSpec
|
| Field Summary |
|---|
| Fields inherited from class org.apache.camel.component.cxf.jaxrs.DefaultCxfRsBinding |
|---|
camelToCxfHeaderMap, cxfToCamelHeaderMap |
| Constructor Summary | |
|---|---|
SimpleCxfRsBinding()
|
|
| Method Summary | |
|---|---|
protected void |
bindBody(org.apache.camel.Message in,
Object[] paramArray,
int singleBodyIndex)
Binds the message body. |
protected void |
bindHeadersFromSubresourceLocators(org.apache.cxf.message.Exchange cxfExchange,
org.apache.camel.Exchange camelExchange)
Transfers path parameters from the full path (including ancestor subresource locators) into Camel IN Message Headers. |
protected void |
bindParameters(org.apache.camel.Message in,
Object[] paramArray,
String[] paramNames,
int numberParameters)
Binds JAX-RS parameter types (@HeaderParam, @QueryParam, @MatrixParam, etc.) to the exchange. |
protected Object |
buildResponse(org.apache.camel.Exchange camelExchange,
Object base)
Builds the response for the client. |
protected Map<String,String> |
filterCamelHeadersForResponseHeaders(Map<String,Object> headers,
org.apache.camel.Exchange camelExchange)
Filters the response headers that will be sent back to the client. |
Object |
populateCxfRsResponseFromExchange(org.apache.camel.Exchange camelExchange,
org.apache.cxf.message.Exchange cxfExchange)
Populate the CxfRsResponse object from the camel exchange |
void |
populateExchangeFromCxfRsRequest(org.apache.cxf.message.Exchange cxfExchange,
org.apache.camel.Exchange camelExchange,
Method method,
Object[] paramArray)
Populate the camel exchange from the CxfRsRequest, the exchange will be consumed by the processor which the CxfRsConsumer attached. |
| Methods inherited from class org.apache.camel.component.cxf.jaxrs.DefaultCxfRsBinding |
|---|
bindCamelHeadersToRequestHeaders, bindCamelMessageBodyToRequestBody, bindResponseHeadersToCamelHeaders, bindResponseToCamelBody, copyMessageHeader, copyOperationResourceInfoStack, copyProtocolHeader, getCamelToCxfHeaderMap, getCxfToCamelHeaderMap, getHeaderFilterStrategy, setCamelToCxfHeaderMap, setCxfToCamelHeaderMap, setHeaderFilterStrategy |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleCxfRsBinding()
| Method Detail |
|---|
public void populateExchangeFromCxfRsRequest(org.apache.cxf.message.Exchange cxfExchange,
org.apache.camel.Exchange camelExchange,
Method method,
Object[] paramArray)
CxfRsBinding
populateExchangeFromCxfRsRequest in interface CxfRsBindingpopulateExchangeFromCxfRsRequest in class DefaultCxfRsBindingcxfExchange - cxf exchange objectcamelExchange - camel exchange objectmethod - the method which is need for the camel componentparamArray - the parameter list for the method invocation
public Object populateCxfRsResponseFromExchange(org.apache.camel.Exchange camelExchange,
org.apache.cxf.message.Exchange cxfExchange)
throws Exception
CxfRsBinding
populateCxfRsResponseFromExchange in interface CxfRsBindingpopulateCxfRsResponseFromExchange in class DefaultCxfRsBindingcamelExchange - camel exchange objectcxfExchange - cxf exchange object
Exception - can be thrown if error in the binding process
protected Object buildResponse(org.apache.camel.Exchange camelExchange,
Object base)
Response object, which gives the user a better control on the response behaviour.
If the message body is already an instance of Response, we reuse it and just inject the relevant HTTP headers.
camelExchange - base -
protected Map<String,String> filterCamelHeadersForResponseHeaders(Map<String,Object> headers,
org.apache.camel.Exchange camelExchange)
DefaultCxfRsBinding doesn't filter the response headers according to the HeaderFilterStrategy,
so we handle this task in this binding.
headers - camelExchange -
protected void bindHeadersFromSubresourceLocators(org.apache.cxf.message.Exchange cxfExchange,
org.apache.camel.Exchange camelExchange)
protected void bindParameters(org.apache.camel.Message in,
Object[] paramArray,
String[] paramNames,
int numberParameters)
in - paramArray - paramNames - numberParameters -
protected void bindBody(org.apache.camel.Message in,
Object[] paramArray,
int singleBodyIndex)
in - paramArray - singleBodyIndex -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||