commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: HTTP proxy for commons XMLConfiguration
Date Wed, 15 Apr 2009 19:58:14 GMT
Christoph Jaehnigen schrieb:
> Hi, I need some advice with the Commons Configuration library.
> I use a XML file for configuration storage which has a DTD specified
> being reachable by a HTTP URI. I need to use a HTTP proxy on the
> executing machine.
> When I try to load the XML configuration, also with setValidate() to
> false I get a ConfigurationException with the message: Unable to load
> the configuration. When removing the DTD statement the configuration
> loads just fine.
> So: is Apache commons-configuration HTTP proxy aware? Does it use the
> actual JVM settings? I also tried to use the -Dhttp.proxyHost system
> properties settings with no success.
> So, how to do it? Btw. machine is WinXP and I'm using Eclipse as IDE
> with m2eclipse for Maven support.
> Thx
> Chris

Hm, good question.

XMLConfiguration does not load the DTD on its own, but relies on the XML 
parser used. The parser itself is obtained using a default 
DocumentBuilderFactory. I would expect that the XML parser understands 
the proxy-related system variables and uses them if they are set. (Note 
that the DTD has to be loaded in any case, even if validation is 
disabled, because it might contain entity definitions that have to be 

For performance reasons it would be better not to load the DTD from a 
HTTP server, but ship a local copy with your application. You can put it 
somewhere on the class path. You can then use the method 
registerEntityId() of XMLConfiguration to map the public ID of the DTD 
to a local resource. That way no network access is required.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message