request.getServletContext().getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\ / f) i) E5 I; V7 a
request.getServletPath() 获取客户端请求的路径名,如:/object/delObject
/ ~2 S# @4 |1 i1 Y! u' yrequest.getServerName() 获取服务器地址,如:localhost
0 v$ z/ @$ I0 O9 rrequest.getServerPort() 获取服务器端口,如8080
7 g' p$ b; A' r! M& Orequest.getContextPath() 获取项目名称,如:TestSytem # p1 K+ R, b" D' ~- Q" D
request.getLocalAddr() 获取本地地址,如:127.0.0.1
: I, r3 A$ b7 Y9 arequest.getLocalName() 获取本地IP映射名,如:localhost / ?6 f* x. D$ P2 c9 c+ f
request.getLocalPort() 获取本地端口,如:8090 ! Z6 z, [+ m4 G) ]/ g4 K a3 |- H# z2 b
request.getRealPath("/") 获取项目所在服务器的全路径,如:D:\Program Files\apache-tomcat-7.0.25\webapps\TestSytem\
; B u) V% X+ @/ Xrequest.getRemoteAddr() 获取远程主机地址,如:127.0.0.1
. _# ~9 K4 l) C- Orequest.getRemoteHost() 获取远程主机,如:127.0.0.1
# c# F/ s$ |- a$ `3 mrequest.getRemotePort() 获取远程客户端端口,如:3623 ( p7 G/ l2 n" T6 Q& B3 L
request.getRequestedSessionId() 获取会话session的ID,如:823A6BACAC64FB114235CBFE85A46CAA * j& p% a6 d: u$ d! V) b" t2 A
request.getRequestURI() 获取包含项目名称的请求路径,如:/TestSytem/object/delObject
' V, [ f& X& a1 B& }request.getRequestURL().toString() 获取请求的全路径,如:http://localhost:8090/TestSytem/object/delObject
, Y, g% m; D% P) b |