request.getServletContext().getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\ 8 Q* i0 D0 m2 z1 c& m9 r
request.getServletPath() 获取客户端请求的路径名,如:/object/delObject ; B* ]" N: d, ? U+ F2 T# _
request.getServerName() 获取服务器地址,如:localhost ' H7 ~3 h3 X3 X- W+ _( w
request.getServerPort() 获取服务器端口,如8080
0 |# ]$ E& L0 Wrequest.getContextPath() 获取项目名称,如:TestSytem
8 l& k; a# _7 P. z* irequest.getLocalAddr() 获取本地地址,如:127.0.0.1
/ Z9 |$ i$ X! Z0 b S6 \0 prequest.getLocalName() 获取本地IP映射名,如:localhost 8 B# U7 E% Y) M: u4 j
request.getLocalPort() 获取本地端口,如:8090
, h% Z/ ~7 l( {& D, erequest.getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\
+ O( {) X7 @9 a- n- M1 Qrequest.getRemoteAddr() 获取远程主机地址,如:127.0.0.1
+ E0 f8 f: p- ^request.getRemoteHost() 获取远程主机,如:127.0.0.1 5 p2 K; i7 t) {6 Q7 o7 W4 D
request.getRemotePort() 获取远程客户端端口,如:3623
5 j3 |# P; j. {) lrequest.getRequestedSessionId() 获取会话session的ID,如:823A6BACAC64FB114235CBFE85A46CAA
, L3 u8 W; U: M2 R# s8 irequest.getRequestURI() 获取包含项目名称的请求路径,如:/TestSytem/object/delObject - f( d9 N# I8 ~% q$ @2 J
request.getRequestURL().toString() 获取请求的全路径,如:http://localhost:8090/TestSytem/object/delObject ' w( B, P# ^9 S1 J# e6 a, d$ N
|