I am currently getting a relative url route as a String via:
String url = controllers.directory.routes.Directory.viewOrganisation( org.id ).url();
This works fine however I would like to get the full absolute url. I am sure this is simple, I just can't seem to find it.
Alternatively, how can I get the current domain within a view to add to the relative url?
Indeed it is simple and it was also answered on the Stack
Follow this question: How to reverse generate an absolute URL from a route on Play 2 Java?
In very general you need:
routes.MyController.myMethod().absoluteURL(request());
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