use of org.exist.protocolhandler.xmlrpc.XmlrpcInputStream in project exist by eXist-db.
the class AnyUriResolver method resolveEntity.
@Override
public XMLInputSource resolveEntity(XMLResourceIdentifier xri) throws XNIException, IOException {
if (xri.getExpandedSystemId() == null && xri.getLiteralSystemId() == null && xri.getNamespace() == null && xri.getPublicId() == null) {
// quick fail
return null;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Resolving XMLResourceIdentifier: {}", getXriDetails(xri));
}
String resourcePath = null;
String baseSystemId = null;
if (firstTime) {
// First time use constructor supplied path
resourcePath = docPath;
baseSystemId = parentURI;
xri.setExpandedSystemId(docPath);
firstTime = false;
} else {
resourcePath = xri.getExpandedSystemId();
}
xri.setBaseSystemId(docPath);
LOG.debug("resourcePath='{}'", resourcePath);
// prevent NPE
if (resourcePath == null) {
return null;
}
InputStream is = null;
if (resourcePath.startsWith("xmldb:")) {
final XmldbURL xmldbURL = new XmldbURL(resourcePath);
if (xmldbURL.isEmbedded()) {
is = new EmbeddedInputStream(xmldbURL);
} else {
is = new XmlrpcInputStream(threadGroup, xmldbURL);
}
} else {
is = new URL(resourcePath).openStream();
}
final XMLInputSource xis = new XMLInputSource(xri.getPublicId(), resourcePath, baseSystemId, is, "UTF-8");
if (LOG.isDebugEnabled()) {
LOG.debug("XMLInputSource: {}", getXisDetails(xis));
}
return xis;
}
use of org.exist.protocolhandler.xmlrpc.XmlrpcInputStream in project exist by eXist-db.
the class EmbeddedURLConnection method getInputStream.
@Override
public InputStream getInputStream() throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug(url);
}
final XmldbURL xmldbURL = new XmldbURL(url);
final InputStream inputstream;
if (xmldbURL.isEmbedded()) {
inputstream = new EmbeddedInputStream(xmldbURL);
} else {
inputstream = new XmlrpcInputStream(threadGroup, xmldbURL);
}
return inputstream;
}
Aggregations