Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get absolute route url as String In Play framework 2?

Tags:

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?

like image 860
afxdesign Avatar asked Sep 25 '12 17:09

afxdesign


1 Answers

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()); 
like image 199
biesior Avatar answered Sep 29 '22 23:09

biesior