Class DataSourceCompositeResolver
java.lang.Object
org.apache.commons.mail2.jakarta.resolver.DataSourceBaseResolver
org.apache.commons.mail2.jakarta.resolver.DataSourceCompositeResolver
- All Implemented Interfaces:
DataSourceResolver
A composite data source resolver. It allows to resolve data sources coming from multiple locations such as the classpath, the file system or an URL.
- Since:
- 1.3
-
Constructor Summary
ConstructorDescriptionDataSourceCompositeResolver
(DataSourceResolver[] dataSourceResolvers) Constructs a new instance.DataSourceCompositeResolver
(DataSourceResolver[] dataSourceResolvers, boolean isLenient) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the underlying data source resolvers.jakarta.activation.DataSource
Resolves the given resource location to aDataSource
.jakarta.activation.DataSource
Resolves the given resource location to aDataSource
.Methods inherited from class org.apache.commons.mail2.jakarta.resolver.DataSourceBaseResolver
isCid, isFileUrl, isHttpUrl, isLenient
-
Constructor Details
-
DataSourceCompositeResolver
Constructs a new instance.- Parameters:
dataSourceResolvers
- a list of resolvers being used
-
DataSourceCompositeResolver
Constructs a new instance.- Parameters:
dataSourceResolvers
- a list of resolvers being usedisLenient
- shall we ignore resources not found or throw an exception?
-
-
Method Details
-
getDataSourceResolvers
Gets the underlying data source resolvers.- Returns:
- underlying data source resolvers
-
resolve
Resolves the given resource location to aDataSource
.- Parameters:
resourceLocation
- the location of the resource- Returns:
- the
DataSource
- Throws:
IOException
- the resource was not found
-
resolve
public jakarta.activation.DataSource resolve(String resourceLocation, boolean isLenient) throws IOException Resolves the given resource location to aDataSource
.- Parameters:
resourceLocation
- the location of the resourceisLenient
- shall we ignore resources not found or complain with an exception?- Returns:
- the data source containing the resource or null if the resource was not found in lenient mode
- Throws:
IOException
- resolving the resource failed
-