diff options
author | David A. Madore <david+git@madore.org> | 2010-04-11 22:09:04 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2010-04-11 22:09:04 +0200 |
commit | 7766f09c66945626ee883ad1a6710c2fe18dfef3 (patch) | |
tree | 1e067d8d1aa55af78f283382ba805eefdaaf8978 | |
parent | c5d9cae77b1cf62735550bfe9a1161b72421f5e2 (diff) | |
download | damlengine-7766f09c66945626ee883ad1a6710c2fe18dfef3.tar.gz damlengine-7766f09c66945626ee883ad1a6710c2fe18dfef3.tar.bz2 damlengine-7766f09c66945626ee883ad1a6710c2fe18dfef3.zip |
Handle x-daml-magic URL (this should go away eventually, of course).
-rw-r--r-- | org/madore/damlengine/Resolver.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/org/madore/damlengine/Resolver.java b/org/madore/damlengine/Resolver.java index 80f8afb..103659c 100644 --- a/org/madore/damlengine/Resolver.java +++ b/org/madore/damlengine/Resolver.java @@ -1,5 +1,6 @@ package org.madore.damlengine; +import java.io.StringReader; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -111,6 +112,27 @@ public final class Resolver return systemId; } + protected String damlMagic(String uri) { + if ( uri.equals("x-daml-magic://daml/weblog/doindex.xml") ) + return "IGNORE"; + else if ( uri.equals("x-daml-magic://daml/weblog/domaxentries.xml") ) + return "INCLUDE"; + else if ( uri.equals("x-daml-magic://daml/weblog/maxentries.xml") ) + return "20"; + else if ( uri.equals("x-daml-magic://daml/weblog/domonth.xml") ) + return "IGNORE"; + else if ( uri.equals("x-daml-magic://daml/weblog/month.xml") ) + return ""; + else if ( uri.equals("x-daml-magic://daml/weblog/docategory.xml") ) + return "IGNORE"; + else if ( uri.equals("x-daml-magic://daml/weblog/category-en.xml") ) + return ""; + else if ( uri.equals("x-daml-magic://daml/weblog/category-fr.xml") ) + return ""; + else + return null; + } + // Interface LSResourceResolver public LSInput resolveResource(String type, @@ -118,6 +140,10 @@ public final class Resolver String publicId, String systemId, String baseURI) { + String str = damlMagic(systemId); + if ( str != null ) + return new DOMInputImpl(publicId, systemId, baseURI, + str, "UTF-8"); String resolved = resolve(namespaceURI, publicId, systemId, baseURI); return new DOMInputImpl(publicId, resolved, baseURI); } @@ -126,6 +152,12 @@ public final class Resolver public InputSource resolveEntity(String publicId, String systemId) throws SAXException { + String str = damlMagic(systemId); + if ( str != null ) { + InputSource source = new InputSource(new StringReader(str)); + source.setPublicId(publicId); + return source; + } String resolved = resolve(null, publicId, systemId, null); InputSource source = new InputSource(resolved); source.setPublicId(publicId); @@ -137,6 +169,12 @@ public final class Resolver public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException { + String str = damlMagic(systemId); + if ( str != null ) { + InputSource source = new InputSource(new StringReader(str)); + source.setPublicId(publicId); + return source; + } String resolved = resolve(null, publicId, systemId, baseURI); InputSource source = new InputSource(resolved); source.setPublicId(publicId); |