Quick questions in CxfBinding

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Quick questions in CxfBinding

William Tam
In cleanup the camel-cxf component, I have the following questions.

In CxfProducer.process() method (below), it creates and passes an
empty HashMap to the  CxfBinding.propogateContext() method.
            // Get context from message
            Map<String, Object> context = new HashMap<String, Object>();
            Map<String, Object> responseContext =
CxfBinding.propogateContext(inMessage, context);

Step inside the CxfBinding.propogateContext() method, the following
code creates a WrappedMessageContext which is in the
org.apache.cxf.jaxws.context package.

 // TODO map the JAXWS properties to cxf
        if (requestContext != null) {
            Map<String, Object> realMap = new HashMap<String, Object>();
            WrappedMessageContext ctx = new WrappedMessageContext(realMap,
                                                                  null,

Scope.APPLICATION);
            ctx.putAll(requestContext);
            requestContext = realMap;

        }

Since requestContext is always empty, ctx.putAll() will not all thing
to  ctx (the WrappedMessageContext).   In the end, requestContext is
still a empty HashMap.   This (CxfProducer.process()) the only place
that calls CxfBinding.propogateContext().  So, what is the intention
of using a WrappedMessageContext in the snippet?  And, do we need to
worry about the TODO comment?

Thanks,
William
Reply | Threaded
Open this post in threaded view
|

Re: Quick questions in CxfBinding

Willem.Jiang
Administrator
Hi William,

Thanks for review my old codes, I had to admit the context which is
passed into the propogateContext is useless.
CxfBinding.propogateContext() just get the request and response context
from the inMessage. the context codes may be left from the refactoring a
year ago.

And the TODO tag should be removed, we just leverage the CXF's utils
class WrappedMessageContext to implement the JAXWS properties to cxf
internal properties mapping.

Willem

William Tam wrote:

> In cleanup the camel-cxf component, I have the following questions.
>
> In CxfProducer.process() method (below), it creates and passes an
> empty HashMap to the  CxfBinding.propogateContext() method.
>             // Get context from message
>             Map<String, Object> context = new HashMap<String, Object>();
>             Map<String, Object> responseContext =
> CxfBinding.propogateContext(inMessage, context);
>
> Step inside the CxfBinding.propogateContext() method, the following
> code creates a WrappedMessageContext which is in the
> org.apache.cxf.jaxws.context package.
>
>  // TODO map the JAXWS properties to cxf
>         if (requestContext != null) {
>             Map<String, Object> realMap = new HashMap<String, Object>();
>             WrappedMessageContext ctx = new WrappedMessageContext(realMap,
>                                                                   null,
>
> Scope.APPLICATION);
>             ctx.putAll(requestContext);
>             requestContext = realMap;
>
>         }
>
> Since requestContext is always empty, ctx.putAll() will not all thing
> to  ctx (the WrappedMessageContext).   In the end, requestContext is
> still a empty HashMap.   This (CxfProducer.process()) the only place
> that calls CxfBinding.propogateContext().  So, what is the intention
> of using a WrappedMessageContext in the snippet?  And, do we need to
> worry about the TODO comment?
>
> Thanks,
> William
>