笔记记录
1、浏览器上输入的地址:http://localhost:8080/abc/quick24
2、获取路径的代码
@RequestMapping("/quick24")
@ResponseBody
public String quick24(HttpServletRequest request) {
System.out.println("URI:"+request.getRequestURI());
System.out.println("URL:"+request.getRequestURL());
System.out.println("项目的根路径名 ContextPath:" + request.getContextPath());
System.out.println("项目根路径下的路径 ServletPath:" + request.getServletPath());
System.out.println("Scheme:" + request.getScheme());
System.out.println("Protocol:" + request.getProtocol());
System.out.println("ServerName:" + request.getServerName());
return "index";
}
3、显示路径
URI:/abc/quick24
URL:http://localhost:8080/abc/quick24
项目的根路径名 ContextPath:
项目根路径下的路径 ServletPath:/abc/quick24
Scheme:http
Protocol:HTTP/1.1
ServerName:localhost