Package com.vaadin.flow.di
Class LookupInitializer.ResourceProviderImpl
java.lang.Object
com.vaadin.flow.di.LookupInitializer.ResourceProviderImpl
- All Implemented Interfaces:
ResourceProvider
- Enclosing class:
LookupInitializer
protected static class LookupInitializer.ResourceProviderImpl
extends Object
implements ResourceProvider
Default implementation of
ResourceProvider.- Author:
- Vaadin Ltd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetApplicationResource(String path) Gets the resource identified bypathlocated in the application bundle (jar) which may be found using this resource provider instance.Gets all the resources identified bypathlocated in in the application bundle (jar) which may be found using this resource provider.getClientResource(String path) Gets "flow-client" bundle resource identified by thepath.Gets "flow-client" bundle resource content identified by thepath.protected voidsetApplicationClassLoader(ClassLoader applicationClassLoader) Sets the class loader of the application, which is searched for resources before the class loader of Flow.
-
Constructor Details
-
ResourceProviderImpl
public ResourceProviderImpl()Creates a new instance.
-
-
Method Details
-
setApplicationClassLoader
Sets the class loader of the application, which is searched for resources before the class loader of Flow.The two differ when Flow is loaded by a parent of the application class loader, for example from the
libfolder of an EAR or from a module layer of its own, and the application resources, such as the frontend bundle, are not visible to the class loader of Flow.- Parameters:
applicationClassLoader- the class loader of the application, ornullto search the class loader of Flow only
-
getApplicationResource
Description copied from interface:ResourceProviderGets the resource identified bypathlocated in the application bundle (jar) which may be found using this resource provider instance.If the provider doesn't contain any information about application bundle or there is no resource with the given path then this method returns
null.- Specified by:
getApplicationResourcein interfaceResourceProvider- Parameters:
path- the resource path- Returns:
- an URL of the resource, may be
null
-
getApplicationResources
Description copied from interface:ResourceProviderGets all the resources identified bypathlocated in in the application bundle (jar) which may be found using this resource provider.If the provider doesn't contain any information about application bundle or there is no resource with the given path then this method returns an empty list.
- Specified by:
getApplicationResourcesin interfaceResourceProvider- Parameters:
path- the resource path- Returns:
- a list of URLs of the resources or an empty list if resources are not found
- Throws:
IOException- if there is an I/O error
-
getClientResource
Description copied from interface:ResourceProviderGets "flow-client" bundle resource identified by thepath.- Specified by:
getClientResourcein interfaceResourceProvider- Parameters:
path- the resource path- Returns:
- an URL of the resource, may be
null
-
getClientResourceAsStream
Description copied from interface:ResourceProviderGets "flow-client" bundle resource content identified by thepath.- Specified by:
getClientResourceAsStreamin interfaceResourceProvider- Parameters:
path- the resource path- Returns:
- an URL of the resource, may be
null - Throws:
IOException- If there is an I/O error.
-