Package io.jmix.core.impl
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
-
Field Summary
Fields inherited from interface org.springframework.core.io.ResourceLoader
CLASSPATH_URL_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.core.io.Resource
getResource
(String location) Search for a resource according to the following rules: If the location represents an URL, return a newUrlResource
for this URL. Try to find a file below theconf
directory usinglocation
as relative path.getResourceAsStream
(String location) Searches for a resource according to the rules explained inResources
and returns the resource as stream if found.getResourceAsString
(String location) Searches for a resource according to the rules explained inResources
and returns the resource as string if found.void
setResourceLoader
(org.springframework.core.io.ResourceLoader resourceLoader)
-
Constructor Details
-
ResourcesImpl
@Autowired public ResourcesImpl(org.springframework.core.env.Environment environment)
-
-
Method Details
-
getResourceAsStream
Description copied from interface:Resources
Searches for a resource according to the rules explained inResources
and returns the resource as stream if found. The returned stream should be closed after use.- Specified by:
getResourceAsStream
in interfaceResources
- Parameters:
location
- resource location- Returns:
- InputStream or null if the resource is not found
-
getResourceAsString
Description copied from interface:Resources
Searches for a resource according to the rules explained inResources
and returns the resource as string if found.- Specified by:
getResourceAsString
in interfaceResources
- Parameters:
location
- resource location- Returns:
- resource content or null if the resource is not found
-
getResource
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 usinglocation
as relative path. If found, return a newUrlResource
for this file. - Otherwise return a new
ClassPathResource
to retrieve content from classpath.
- Specified by:
getResource
in interfaceorg.springframework.core.io.ResourceLoader
- Parameters:
location
- resource location- Returns:
- resource reference
- If the location represents an URL, return a new
-
getClassLoader
- Specified by:
getClassLoader
in interfaceorg.springframework.core.io.ResourceLoader
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - Specified by:
setResourceLoader
in interfaceorg.springframework.context.ResourceLoaderAware
-