commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Sayatovic/AMIG <BSayato...@amig.com>
Subject Digester: setting a java.net.URL property
Date Tue, 05 Aug 2003 19:58:09 GMT
I have an XML file that contains this sort of element:

        <FtpUrl>ftp://user:pass@host:21/some/path</FtpUrl>

I also have a Config object that has a java.net.URL property with a 
getter/setter:

        public class MyConfig {
                // ...
                public URL getFtpUrl();
                public void setFtpUrl(URL url);
                // ...
        }

However, I can't decide how to tie these together with Digester.  I 
couldn't get a bean property setter to work, I suspect because there is no 
conversion between the String in the XML file and a java.net.URL.  Second, 
I thought I'd use an ObjectCreationFactory with a FactoryCreateRule to use 
the body text to construct a new URL and return it, then add a SetNextRule 
to set that URL into the config object.  But I can't seem to get at the 
body text via a ObjectCreationFactory (I get the attribtues passed to the 
factory,but not the body from what I could tell).

So, my next step is to create my own Rule and add it to the Digester.  But 
that seems a bit extreme.  Is there a less custom way of doing this?

Regards,
Brian.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message