Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Play Framework 2.3.x) How to get the previous url?

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.

like image 673
Kory Avatar asked May 22 '14 20:05

Kory


People also ask

In which folder does play expect routes file?

The answer to this question lies in the app/conf/routes configuration file. Play's router translates HTTP requests into action calls.

What is routes scala?

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.


1 Answers

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")
like image 86
biesior Avatar answered Sep 28 '22 01:09

biesior