request.getURL()和request.getURI()

request. getRequestURI() 返回值类似:/ServletTest/servlet/Hello
request. getRequestURL() 返回值类似: http://localhost:8080/ServletTest/servlet/Hello

 

再如:

 

request.getContextPath() = /ServletTest

 

request.getLocalAddr() = 127.0.0.1


request.getPathInfo() = null


request.getPathTranslated() = null


request.getRemoteAddr() = 127.0.0.1


request.getRequestURI() = /ServletTest/servlet/Hello

 

request.getScheme() = http


request.getServerName() = 127.0.0.1


request.getServletPath() = /servlet/Hello

 

request.getClass() = class org.apache.catalina.connector.RequestFacade


request.getHeaderNames() = org.apache.tomcat.util.http.NamesEnumerator@1fb050c


request.getLocale() = zh_CN


request.getLocales() = org.apache.catalina.util.Enumerator@1088a1b

 

request.getParameterMap() = {}


request.getRequestURL() = http://127.0.0.1:8080/ServletTest/servlet/Hello

 

request.getUserPrincipal() = null


request.getParameterNames() = java.util.Hashtable$EmptyEnumerator@1db6942


request.getRealPath("newsPub") =

 

D:\zfsca\.metadata\.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\ServletTest\newsPub

 

request.getRealPath("/") =

 

D:\zfsca\.metadata\.plugins\com.genuitec.eclipse.easie.tomcat.myeclipse\tomcat\webapps\ServletTest\

你可能感兴趣的:(apache,tomcat,jsp,Web,浏览器)