标签:oid windows 访问 sys else contain rmi http win
@RequestMapping(value="/test") @ResponseBody public void test1(HttpServletRequest request,Questionnaire quest,String questOptions){ String ipAddress = null; if (request.getHeader("x-forwarded-for") == null) { ipAddress = request.getRemoteAddr(); }else{ if(request.getHeader("x-forwarded-for").length() > 15){ String [] aStr = request.getHeader("x-forwarded-for").split(","); ipAddress = aStr[0]; } else{ ipAddress = request.getHeader("x-forwarded-for"); } } String terminal = request.getHeader("User-Agent"); if(terminal.contains("Windows NT")){ terminal = "PC端"; }else{ terminal = "移动端"; } System.out.println("访客IP:"+ipAddress); System.out.println("用户访问来源:"+terminal); System.out.println("访问URL:"+request.getRequestURL()); }
【java】服务器端获取用户访问的URL/用户IP/PC还是移动端
标签:oid windows 访问 sys else contain rmi http win
原文地址:http://www.cnblogs.com/sxdcgaq8080/p/7027567.html