java获取真实的全路径

java获取真实的全路径

request.getScheme()---->http;
InetAddress.getLocalHost().getHostAddress()----->应用所在的地址如:10.1.1.134;
request.getServerPort()----->获取应用的端口好如:8080
request.getContextPath()----->获取工程的名称如:javaTest

例子:
request.getScheme()+"://"+InetAddress.getLocalHost().getHostAddress()+":"+request.getServerPort()+request.getContextPath()+"/approvalsExe.do?method=apprList&seq=1&mNumber=Approvals_module

http://10.1.1.134:8080/javaTest/approvalsExe.do?method=apprList&seq=1&mNumber= Approvals_module

你可能感兴趣的:(java获取真实的全路径)