Customer Information at webservice

How can I access client data such as IP, browser, etc. in a web service in java?

+3
source share
3 answers
String ip = request.getRemoteAddress();
String browser = request.getHeader("User-Agent");
+1
source

if you use an axis or Jax Rpc, then you can get the IP address and browser, you need to do this on a stub on the server side.

HttpServletRequest httpReq = (HttpServletRequest) MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);

String ip = httpReq.getRemoteAddr();

String browser = httpReq.getHeader("User-Agent");
+1
source

, , HTTP, : , .. - IP- , . IP- , .

0

Source: https://habr.com/ru/post/1717227/


All Articles