简体   繁体   中英

(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.

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM