use of org.exist.util.EXistURISchemeURIResolver in project exist by eXist-db.
the class XsltURIResolverHelper method getXsltURIResolver.
/**
* Get a URI Resolver for XSLT Modules.
*
* @param brokerPool the database
* @param defaultResolver the default fallback resolver, or null
* @param base the URI base, or null
* @param avoidSelf true to avoid nesting {@link URIResolverHierarchy}
*
* @return the URIResolver, or null if there is no resolver
*/
@Nullable
public static URIResolver getXsltURIResolver(final BrokerPool brokerPool, @Nullable final URIResolver defaultResolver, @Nullable final String base, final boolean avoidSelf) {
final List<URIResolver> resolvers = new ArrayList<>();
if (base != null) {
// database resolver
resolvers.add(new EXistURISchemeURIResolver(new EXistURIResolver(brokerPool, base)));
}
// EXpath Pkg resolver
brokerPool.getExpathRepo().map(repo -> resolvers.add(new PkgXsltModuleURIResolver(repo)));
// default resolver
if (defaultResolver != null) {
if (avoidSelf) {
if (!defaultResolver.getClass().getName().equals(URIResolverHierarchy.class.getName())) {
resolvers.add(defaultResolver);
}
} else {
resolvers.add(defaultResolver);
}
}
if (resolvers.size() > 0) {
return new URIResolverHierarchy(resolvers);
} else {
return null;
}
}
use of org.exist.util.EXistURISchemeURIResolver in project exist by eXist-db.
the class ApacheFopProcessorAdapter method getResourceResolver.
/**
* Returns a scheme aware ResourceResolver which supports:
* file://
* exist:// (which will be translated to xmldb:exist://)
* http://
* https://
*
* @return The resource resolver
*/
private ResourceResolver getResourceResolver(final DBBroker broker, final String baseUri) {
final ResourceResolverFactory.SchemeAwareResourceResolverBuilder builder = ResourceResolverFactory.createSchemeAwareResourceResolverBuilder(ResourceResolverFactory.createDefaultResourceResolver());
final URIResolverAdapter uriResolver = new URIResolverAdapter(new EXistURISchemeURIResolver(new EXistURIResolver(broker.getBrokerPool(), baseUri)));
builder.registerResourceResolverForScheme("exist", uriResolver);
builder.registerResourceResolverForScheme("http", uriResolver);
builder.registerResourceResolverForScheme("https", uriResolver);
return builder.build();
}
Aggregations