In play Framework, how can I get the URL
the user came from in a controller
?
I've tried request.url
, but that isn't working.
The answer to this question lies in the app/conf/routes configuration file. Play's router translates HTTP requests into action calls.
The routes file syntax conf/routes is the configuration file used by the router. This file lists all of the routes needed by the application. Each route consists of an HTTP method and URI pattern, both associated with a call to an Action generator.
Previous url will come with the http headers under the referer
key. In JAVA you can get it using:
String refererUrl = request().getHeader("referer");
and if you doing it in Scala:
val refererUrl = request.headers("referer")
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