HttpServletRequest getRequestURL和getRequestURI

getRequestURL和getRequestURI的区别记录

HttpServletRequest


Request URL: http://localhost:8080/WebServlet/servlet/api?&name=1


1.getRequestURL
http://localhost:8080/WebServlet/servlet/api


2.getRequestURI
/WebServlet/servlet/api


3.getContextPath
/WebServlet


4.getServletPath
/servlet/api

你可能感兴趣的:(Java)