Created
September 16, 2021 18:18
-
-
Save jeffersonchaves/3f0a74db2af7ffc4f70cf7346bd7a999 to your computer and use it in GitHub Desktop.
Servlet Base Path Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String getBaseUrl(HttpServletRequest request) { | |
String baseUrl = request.getRequestURL().substring(0, request.getRequestURL().length() - request.getRequestURI().length()) + request.getContextPath(); | |
return baseUrl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment