First I had this twitter badge link:
@{'/public/images/twitter-icon.png'/}
But now I want to show the Twitter-, Facebook- or LinkedIn icon depending on the type. So, I created a FastTag that takes a type as a parameter, and the code looks like this:
In the view: #{myApp.icon contact.type/} FastTag Java Code: String type = (String) args.get("arg"); out.print("/public/images/" + type + "-icon.png");
It works great. But on our build server, we run the application with a uri prefix, like this
http://ourdomain.com/appname/...
Obviously / public / images ... will not work here. So I thought that I should ask Router for the correct address. I tried the following without success:
Router.reverse("/public/images/" + type + "-icon.png"); Router.reverse("/public/"); Router.reverse("staticDir:public");
All three results throw a NoRouteFoundException. How can I get the correct route for my icons?
In the routes file, I have a default route for static files
GET /public/ staticDir:public
JΓΆrgen lundberg
source share