Grails : getting assets local storage path inside the controller

独自空忆成欢 提交于 2019-12-05 20:01:10
Eduardo Cuomo

Complete example:

class ExampleService {
  def assetResourceLocator

  def someMethod() {
    Resource res = assetResourceLocator.findAssetForURI('test.css')
    String url = res.getURL()
    String uri = res.getURI()
  }
}

Source: https://stackoverflow.com/a/39642278/717267

Look at the AssetProcessorService inside the plugin. There are different function to get the path like getAssetPath or getResolvedAssetPath. This might help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!