How about a thread local?

-----Original Message-----
From: Yair Ben-Meir [mailto:[EMAIL PROTECTED] 
Sent: 16 July 2008 13:36
To: users@cxf.apache.org
Subject: getting the ip address in the action method

Hi

I have a class implementing an interface annotated as a web service. In
the
method of this class, I handle the request.

Now, I want to use the IP of the client in the logic of the method. So I
wrote an interceptor that gets the IP:

public class IpCxfInterceptor extends AbstractPhaseInterceptor<Message>

{

      @Override

      public void handleMessage(Message message) throws Fault

      {

            HttpServletRequest request =

 

            (HttpServletRequest)
message.get(AbstractHTTPDestination.HTTP_REQUEST);

            String clientAddress = null;

            if (null != request)

            {

                  clientAddress = request.getRemoteAddr();

            }

            System.out.println("IP="

                + clientAddress);

      }

      

      public IpCxfInterceptor()

      {

            super(Phase.RECIEVE);

      }

}

 

The problem is - how can I pass the IP to the method? The method's
arguments
are according to the WSDL, I can't change them and add "ip" or something
like that.

 

Thanks

Yair

 

 


________________________________________________________________________
In order to protect our email recipients, Betfair Group use SkyScan from 
MessageLabs to scan all Incoming and Outgoing mail for viruses.

________________________________________________________________________

Reply via email to