Grails: getting local resource storage path inside controller

I need to extract the physical path of the resource folder in order to write the file from my controller.

Any short way to achieve file resilience from the controller?

+3


source to share


2 answers


Take a look at the AssetProcessorService inside the plugin. There are various functions for getting the path, such as getAssetPath or getResolvedAssetPath . This might help you.



0


source


Complete example:

class ExampleService {
  def assetResourceLocator

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

      



Source: fooobar.com/questions/2251032 / ...

0


source







All Articles