IT지식

getRequestURL() vs getRequestURI() vs 프로젝트 Path만

오선지♬ 2024. 6. 18. 18:33
728x90
반응형

 

getRequestURL()  - 프로토콜, 서버 이름 및 포트를 포함한 전체 URL을 반환

getRequestURI()  - 경로만 반환

getcontextPath()  - 프로젝트경로만 반환

 

 

http://localhost:8080/myapp/resource?id=123

getRequestURL() →  http://localhost:8080 /myapp/resource 반환

getRequestURI() →  /myapp/resource 반환

getcontextPath() → /myapp 반환

728x90
반응형