我的方法:
@Resource
private WebServiceContext webServiceContext;
HttpExchange exchange = (HttpExchange)mc.get(JAXWSProperties.HTTP_EXCHANGE);
HttpServletRequest request= (HttpServletRequest)(mc.get(MessageContext.SERVLET_REQUEST));
其中,HttpServletRequest始终为NULL。
用HttpExchange获取IP:
InetSocketAddress isa = exchange.getRemoteAddress();
ip = isa.getAddress().getHostAddress(); //获取IP
这个IP始终都是路由器分配的虚拟IP,并非客户端的真实IP
请问各位大神,如何才能获取到客户端的真实IP鸭~
@Resource
private WebServiceContext webServiceContext;
HttpExchange exchange = (HttpExchange)mc.get(JAXWSProperties.HTTP_EXCHANGE);
HttpServletRequest request= (HttpServletRequest)(mc.get(MessageContext.SERVLET_REQUEST));
其中,HttpServletRequest始终为NULL。
用HttpExchange获取IP:
InetSocketAddress isa = exchange.getRemoteAddress();
ip = isa.getAddress().getHostAddress(); //获取IP
这个IP始终都是路由器分配的虚拟IP,并非客户端的真实IP
请问各位大神,如何才能获取到客户端的真实IP鸭~