Why go through the trouble of using an interceptor for this?
If you do
@Resource
WebServiceContext ctx;
The ctx itself has the HttpServletRequest in it as well.
MessageContext.SERVLET_REQUEST key.
Dan
On Jul 16, 2008, at 8:35 AM, Yair Ben-Meir wrote:
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
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog