request.getServletContext().getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\ U, K# F; _$ x
request.getServletPath() 获取客户端请求的路径名,如:/object/delObject & [, B7 b8 T. _5 f
request.getServerName() 获取服务器地址,如:localhost
5 g9 \' A% C7 |! Brequest.getServerPort() 获取服务器端口,如8080
6 O! `3 i2 I7 e0 G5 O" Yrequest.getContextPath() 获取项目名称,如:TestSytem
O# d& U" K2 krequest.getLocalAddr() 获取本地地址,如:127.0.0.1 2 ^/ S2 E% z, K: q
request.getLocalName() 获取本地IP映射名,如:localhost
+ Q4 l0 f2 Z; v. G+ U* P% Brequest.getLocalPort() 获取本地端口,如:8090
+ l' ~5 Z+ M Z9 v8 C& Y2 ?request.getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\ 9 h9 A: Q6 l. l# n8 u
request.getRemoteAddr() 获取远程主机地址,如:127.0.0.1 - C3 \& @, S0 q i: B' ?
request.getRemoteHost() 获取远程主机,如:127.0.0.1 3 n& T4 C2 j# F7 `$ f6 h
request.getRemotePort() 获取远程客户端端口,如:3623
. O5 G" V9 \5 S% arequest.getRequestedSessionId() 获取会话session的ID,如:823A6BACAC64FB114235CBFE85A46CAA
+ Q2 A; X/ u x: v( erequest.getRequestURI() 获取包含项目名称的请求路径,如:/TestSytem/object/delObject 7 f) h) L+ G/ m* r9 w- ^
request.getRequestURL().toString() 获取请求的全路径,如:http://localhost:8090/TestSytem/object/delObject 9 [+ f% h2 ?' M) r- b5 d3 U
|