I am running a spring framework based web app on Tomcat. My requirement is that any request coming to the server should come to a single servlet. so i made the following configuration in conf/web.xml
<error-page>
<error-code>404</error-code>
<location>/displayMsg.do</location>
</error-page>
So when the user access http://myhost/xyz , request.getRequestURL() returns http://myhost/displayMsg.do
I think the only reason for the requestURL() to return this url is because of the the error page configuration i made. May be because tomcat overwriting the url to this string.
Is it possible to get the exact URL in this case? Please help
I ran into this same problem a couple weeks ago.
You can pull the actual url using
request.getAttribute(\"javax.servlet.forward.request_uri\").toString()
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