方法一:
方法二:
@Resource(name = "org.apache.cxf.jaxws.context.WebServiceContextImpl")
private WebServiceContext context;
HttpServletRequest httpRequest1 = (HttpServletRequest)context.getMessageContext().get(AbstractHTTPDestination.HTTP_REQUEST);
LogConsole.info("ip:" + httpRequest1.getRemoteAddr());
方法二:
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest httpRequest = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
LogConsole.info("ip:" + httpRequest.getRemoteAddr());