I have inherited a JAVA Spring MVC web app. I'm totally new to Spring MVC and very much a novice at JAVA. But my first task is to add the application's URL into an email that is already generated through code.
It is basically a way for the user to click the link and go directly to a specific page. But when I try all the various things I have seen on here that involve HttpServletRequest
and more importantly getRequestURL()
.
I can only get the URL after the Controller takes over. What I need is the what I will refer to as the referring URL--the application URL I see in the browser.
The Controller is a REST service and returns localhost:8181/etc/etc
which doesn't even include the domain for the site. I have tried the various methods like getHeader("Referer")
etc. Again, they just return the post-Controller URL. I've tried added the code to get the correct URL pre-Controller and then pass it to the Controller method. Still gives me the post-Controller URL.