Which version of CXF are your testing with?
I'm using CXF 2.3.1 within Camel 2.6-SNAPSHOT, I can get the remoteAddress without any trouble.

Here is the unit test[1] that you may have a look.
[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java

On 12/31/10 1:16 AM, [email protected] wrote:

Got it!

Thanks Willem.

Here is what I was doing wrong: In the handleMessage method of my
interceptor, I was inspecting the message object using the debugger. It DID
contain the HTTP.REQUEST header as I mentioned earlier, but the
_remoteAddress variable in the Request object was null. The IP address is
actually stored in the "_endp" member of the Request object.

So, as per your suggestion, I added the following two lines at the beginning
of my handleMessage method in the interceptor

<code>
                org.mortbay.jetty.Request jettyRequest =
(org.mortbay.jetty.Request)message.get("HTTP.REQUEST");
                System.out.println("jettyRequest.getRemoteAddr(): " +
jettyRequest.getRemoteAddr());
</code>

and when I step into the getRemoteAddr() method of the Request object, I see
that _remoteAddr is null and therefore _endp.getRemoteAddr() is invoked.

It was just a matter of knowing exactly what stores the IP address and how
to extract it.

Thanks for your help.

Abhishek


--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Reply via email to