Implementing @routes.Assets.versioned("") in java class

I wanted to implement @routes.Assets.versioned("com/images/image.png") using java class currently I'm using the above in my scala.html file for an image which return the path for the image. Now i wanted to call a utils class method like @utils.UtilClass.getImage("com/images/image.png") so that i wanted to append a CDN basepath to the versionised image path that i get from @routes.Assets.versioned() for that i need to replicate the functionality of routes.Assets.versioned() in java class, I tried Assets.versioned("", Asset) which is returning an Action object and dint know how to extract the versioned path from the object. Any help is appreciated.

Answers


It's easy:

String url = 'images/favicon.png';
String versionedUrl = controllers.routes.Assets.versioned(new controllers.Assets.Asset(url)).toString()

For example I have such method in my Handlebars helpers for the Play:

/**
* Do the same as "@routes.Assets.versioned" in Twirl.
* 
* @param url
*          relative path to the asset
* @return actual path to the asset
*/
public static CharSequence asset(final String url) {
  return controllers.routes.Assets.versioned(new controllers.Assets.Asset(url)).toString();
}

Need Your Help

Using UIKit's UIScrollView with SpriteKit

ios objective-c uiscrollview sprite-kit

I read two questions here about that, both with the same answer. The suggested solution was to create the UIScrollView object, and then add it to the parent view of the SKScene in the target scene's

passing the image to dompdf

pdf-generation dompdf html2canvas

I have the following code in my save.php: