jax ws getting client ip

后端 未结 4 629
灰色年华
灰色年华 2020-12-05 20:50

I\'m trying to retrieve the client IP with JAX-WS, I used:

@Resource
WebServiceContext wsContext; 

MessageContext mc = wsContext.getMessageContext();
HttpSe         


        
4条回答
  •  死守一世寂寞
    2020-12-05 21:18

    The following code might work:

    HttpServletRequest request = (HttpServletRequest) messageContext.get("transport.http.servletRequest");
    String hostIp = request.getRemoteAddr();
    

提交回复
热议问题