kheraud
kheraud

Reputation: 5288

Absolute reverse routing with Scala?

In play 1.X it was possible to have an absolute url with reverse routing using :

@@{MyController.method(param)} --> http://www.mydomain.com/myaction/param

instead of relative reverse routing with :

@{MyController.method(param)} --> /myaction/param

I use play 2.0 with scala version. I can retrieve relative routes using :

@routes.MyController.method(param) --> /myaction/param

As "@@" just escapes the "@" reserved for scala statements, is it still possible to have also absolute reverse routing ? I can't find it in the API

Upvotes: 3

Views: 851

Answers (1)

Julien Lafont
Julien Lafont

Reputation: 7877

There is an absoluteUrl method to retrieve the absolute address.

So :

@routes.MyController.method(param).absoluteURL()

Upvotes: 5

Related Questions