Details
-
Improvement
-
Status: Open
-
Resolution: Unresolved
-
1.8
-
None
-
None
-
Operating System: All
Platform: All
Description
ParsedURL basically just supports URLs right now (the Java Runtime's URL protocols plus the RFC 2397 data URL protocol). It seems impossible to add URI resolution with a connection to the user agent. In FOP, it was possible to pipe image loading through FOP's URI resolution by registering an image bridge, but that's not a general mechanism working for all external resources. It should be possible to register a URIResolver (or EntityResolver) with Batik's user agent so all IRI's are resolved through a central entity.
For comparison, FOP works like this: We provide a possibility to register a URIResolver on FopFactory and user agent levels. First the user agent is consulted (if a user agent is available in the context), then the URIResolver on FopFactory is consulted. A URIResolver returns a Source object. If the Source is a StreamSource and contains an InputStream, that is used. A DOMSource is equally supported, if XML documents are loaded. Otherwise, the systemId is assumed to be a URL which is then used via Java's own java.net.URL. If a URI cannot be resolved by any URIResolver, it is assumed to be a URL and handled appropriately.
I think this will require extensive changes all over Batik's codebase (whereever a ParsedURL is instantiated), so this needs to be well thought through. Due to time constraints I cannot work on this right now but have to use an impractical work-around, so I just write this down as a reminder/wish.
References:
http://xml.apache.org/commons/components/resolver/index.html