Class ResourcesImpl

java.lang.Object
io.jmix.core.impl.ResourcesImpl
All Implemented Interfaces:
Resources, org.springframework.beans.factory.Aware, org.springframework.context.ResourceLoaderAware, org.springframework.core.io.ResourceLoader

@Component("core_Resources") public class ResourcesImpl extends Object implements Resources, org.springframework.context.ResourceLoaderAware
  • Field Summary

    Fields inherited from interface org.springframework.core.io.ResourceLoader

    CLASSPATH_URL_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResourcesImpl(org.springframework.core.env.Environment environment)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    org.springframework.core.io.Resource
    getResource(String location)
    Search for a resource according to the following rules: If the location represents an URL, return a new UrlResource for this URL. Try to find a file below the conf directory using location as relative path.
    Searches for a resource according to the rules explained in Resources and returns the resource as stream if found.
    Searches for a resource according to the rules explained in Resources and returns the resource as string if found.
    void
    setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResourcesImpl

      @Autowired public ResourcesImpl(org.springframework.core.env.Environment environment)
  • Method Details

    • getResourceAsStream

      @Nullable public InputStream getResourceAsStream(String location)
      Description copied from interface: Resources
      Searches for a resource according to the rules explained in Resources and returns the resource as stream if found. The returned stream should be closed after use.
      Specified by:
      getResourceAsStream in interface Resources
      Parameters:
      location - resource location
      Returns:
      InputStream or null if the resource is not found
    • getResourceAsString

      @Nullable public String getResourceAsString(String location)
      Description copied from interface: Resources
      Searches for a resource according to the rules explained in Resources and returns the resource as string if found.
      Specified by:
      getResourceAsString in interface Resources
      Parameters:
      location - resource location
      Returns:
      resource content or null if the resource is not found
    • getResource

      public org.springframework.core.io.Resource getResource(String location)
      Search for a resource according to the following rules:
      • If the location represents an URL, return a new UrlResource for this URL.
      • Try to find a file below the conf directory using location as relative path. If found, return a new UrlResource for this file.
      • Otherwise return a new ClassPathResource to retrieve content from classpath.
      Specified by:
      getResource in interface org.springframework.core.io.ResourceLoader
      Parameters:
      location - resource location
      Returns:
      resource reference
    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface org.springframework.core.io.ResourceLoader
    • setResourceLoader

      public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
      Specified by:
      setResourceLoader in interface org.springframework.context.ResourceLoaderAware