The
org.orbeon.oxf.pipeline.api.PipelineDefinition class has a couple of
methods to set inputs:
void addInput(String name, Element element) Add an input with the given name and dom4j Element. void addInput(String name, String url) Add an input with the given name and URL. The addInput(String,String) method should really use a java.net.URI to pass in the url reference rather than a String (not java.net.URL: URI is just a string in a certain format [RFC 2396], whereas URL is a 'live' resolved location, doing nasty things like hitting the DNS server & trying to find stream handlers). (a) this would make it much clearer that the String input shouldn't contain an unparsed xml document string (which is what you assume unless you look at the javadoc, because the other method takes a parsed xml element), plus (b) it means badly formed url references can't be provided. There are a bunch of places downstream which stick to using Strings instead of URIs: these are more 'internal' rather than API classes though: PipelineUtils.createURLGenerator() URLGenerator URLFactory Aside from making the API a bit clearer, using a URI means instead of trickery like (URLFactory): spec.startsWith(OXFHandler.PROTOCOL + ":") you can just do spec.getScheme().equals(OXFHandler.PROTOCOL) Adrian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Adrian,
Yes I think this would make sense. I was looking at that code recently and it has other problems ;-) I entered an RFE to track this: https://forge.objectweb.org/tracker/index.php?group_id=168&atid=350207 -Erik Adrian Baker wrote: > The org.orbeon.oxf.pipeline.api.PipelineDefinition class has a couple of > methods to set inputs: > > void addInput(String name, Element element) > Add an input with the given name and dom4j Element. > void addInput(String name, String url) > Add an input with the given name and URL. > > The addInput(String,String) method should really use a java.net.URI to > pass in the url reference rather than a String (not java.net.URL: URI is > just a string in a certain format [RFC 2396], whereas URL is a 'live' > resolved location, doing nasty things like hitting the DNS server & > trying to find stream handlers). > > (a) this would make it much clearer that the String input shouldn't > contain an unparsed xml document string (which is what you assume unless > you look at the javadoc, because the other method takes a parsed xml > element), plus (b) it means badly formed url references can't be provided. > > There are a bunch of places downstream which stick to using Strings > instead of URIs: these are more 'internal' rather than API classes though: > PipelineUtils.createURLGenerator() > URLGenerator > URLFactory > > Aside from making the API a bit clearer, using a URI means instead of > trickery like (URLFactory): > > spec.startsWith(OXFHandler.PROTOCOL + ":") > > you can just do > > spec.getScheme().equals(OXFHandler.PROTOCOL) > > Adrian Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |