Christopher Schultz wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave,

David Kerber wrote:
Previously, I had been using the java Preferences class, which stores
things in a way that is transparent to the java program (in the
registry on windows, elsewhere on other OS's).

IMHO, the Java Preferences class is a travesty for exactly that reason.
It would have been great if they had allowed the developer to choose the
method of storage (Windows-style INI file, Windows Registry, JNDI, Java
properties file, UNIX run-control, whatever), but they didn't. :(
Yeah, I hated it from the moment I saw it, but at the time I thought it was the only game in town...

I much prefer text files for configs, but for a long time didn't know
there were built-in capabilities for this in java, and didn't want to
bother to roll my own.

Light dawns. Everything in java.util is really good stuff. Well, almost.
Maybe not "Date" and "StrinkTokenizer". But everything else is good, I
swear!
That's probably why a good chunk of Date as been deprecated and replaced with Calendar and particularly GregorianCalendar.


java.util.Properties and java.util.ResourceBundle are very similar. In
fact, I'm not entirely sure why they are not more closely related. You
can use the Properties class to load a properties file (using
Properties.load()), but you can use ResourceBundle.getBundle to load a
properties file from the classpath and /get the right Locale for those
properties/. This is important if you are considering providing
locale-specific properties (like translations of strings).
Not at the moment, but I'll keep it in mind.

If you use ResourceBundle.getBundle, then you don't even need to worry
about ServletContext.getResourceAsStream or anything like that. Just put
your properties files into WEB-INF/classes, or into a JAR file in
WEB-INF/lib, and ResourceBundle will locate and load your file for you.
This doesn't work for our situation because I load multiple apps at completely different context roots from the same documentRoot, but I imagine there are easy workarounds for this. That's also why I have to define my contexts in server.xml.

Dave



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to