I would like to know how can I get the full path of an HTTP request.
If a have a request like http://localhost:8080/path1/path2 how can I get the full /path1/path2?
Using request.getContextPath() returns only the /path1 section.
You need to use the getRequestURI() method:
The documentation describes it thus:
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With