Getting the URL of the current page in Grails

Viewed 40572

In a Grails application I'd like to send a user from page A, then to a form on page B and then back to page A again.

To keep track of which URL to return to I send a "returnPage" parameter to page B containing the URL of page to return to (page A).

Currently I'm using request.getRequestURL() on page A to retrieve the page's URL. However, the URL I get from getRequestURL() does not correspond to the URL the end-user has in his/hers address bar:

request.getRequestURL() == "http://localhost:8080/something/WEB-INF/grails-app/views/layouts/main.gsp"
URL in address bar == "http://localhost:8080/something/some/thing"

How do I obtain the "end-user" URL?

5 Answers
Related