import javax.servlet.http.HttpServletRequest;
HttpServletRequest request
아래와 같은 주소가 있을 경우
http://localhost:8080/template/index.jsp
request.getRequestURI(); // 프로젝트 경로부터 파일까지의 경로 값 ex) /template/index.jsp
request.getContextPath(); // 프로젝트의 경로값만 가져옴 ex) /template
request.getRequestURL(); // 전체 경로 가져옴 ex)http://localhost:8080/template/index.jsp
request.getServletPath(); // 파일명만 가져옴 ex) /index.jsp
// 아래 함수들을 조합하면 주소 정보를 만들 수 있다
request.getScheme(); // http
request.getServerName(); // localhost
request.getServerPort(); // 8080
https://dlevelb.tistory.com/576
https://reference-m1.tistory.com/297