java request 获取_java request获取各种域名信息

一一对应。。

System.out.println("-----ServletPath---" + request.getServletPath());

System.out.println("-----ContextPath---" + request.getContextPath());

System.out.println("-----referer---" + request.getHeader("referer"));

System.out.println("-----host---" + request.getHeader("host"));

System.out.println("-----RequestURI---" + request.getRequestURI());

System.out.println("-----RequestURL---" + request.getRequestURL());

System.out.println("-----ServerName---" + request.getServerName());

System.out.println("-----ServerPort---" + request.getServerPort());

String realPath1 = "http://"+ request.getServerName()+ ":"+ request.getServerPort()+ request.getContextPath()+ request.getServletPath().substring(0,request.getServletPath().lastIn

你可能感兴趣的:(java,request,获取)