In my play 1.x controller I had this:
public static void language(final String language){
Lang.change(language);
Header referer = request.headers.get("referer");
if(referer == null){
index();
}else{
redirect(referer.value());
}
}
I would like to do the same in play 2.x but I have the impression that functionality is not available any more. This is what I have so far
def language(language:String) = Action { implicit request =>
// TODO change language
val referer = request.headers.get("referer")
referer.map{ referer =>
Redirect(referer, FOUND);
}getOrElse(
Ok(views.html.index())
)
}