request.getServletContext().getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\
6 |1 { c( c$ @4 b$ S) g" ]) j; wrequest.getServletPath() 获取客户端请求的路径名,如:/object/delObject
* R4 s# E' G" R8 Vrequest.getServerName() 获取服务器地址,如:localhost ! u" j0 S @. I' O5 W* G$ p: |
request.getServerPort() 获取服务器端口,如8080 : y& H/ v* ^8 a% I6 `
request.getContextPath() 获取项目名称,如:TestSytem
! o3 {# u* y5 s1 T! T: trequest.getLocalAddr() 获取本地地址,如:127.0.0.1 % @% D- w5 z6 }* e
request.getLocalName() 获取本地IP映射名,如:localhost
_9 X0 T1 ]2 g6 V7 wrequest.getLocalPort() 获取本地端口,如:8090
7 B4 K) \" R7 \' z: F* Irequest.getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\ 7 c, C9 p( X3 } I- ], u: q- y& l
request.getRemoteAddr() 获取远程主机地址,如:127.0.0.1
- Q9 y6 {" Q5 R3 _- R4 xrequest.getRemoteHost() 获取远程主机,如:127.0.0.1 ) t& r2 n5 o2 u
request.getRemotePort() 获取远程客户端端口,如:3623
1 v4 U/ Y6 U: Frequest.getRequestedSessionId() 获取会话session的ID,如:823A6BACAC64FB114235CBFE85A46CAA
+ ~. ^, R" i* _request.getRequestURI() 获取包含项目名称的请求路径,如:/TestSytem/object/delObject 4 r$ Q" ^4 g8 t2 P% c
request.getRequestURL().toString() 获取请求的全路径,如:http://localhost:8090/TestSytem/object/delObject : F2 N5 }. F) f$ {5 d5 Z
|