request.getContextPath 上下文,例如 /bignews1 (自帶 「 / 」)get
request.getScheme() 協議,例如HTTP域名
request.getServerName() 域名,例如localhostrequest
request.getServerPort() 端口,例如8080總結
總結:好比,String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() ,協議
結果就是http://localhost:8080/bignews1/ 端口