Thanks for sharing this. I hadn't thought about it. Good.
Pedro
El Mar, 20-12-2005 a las 14:07 -0500, Bryan Lewis escribió:
> Pedro Abelleira Seco wrote:
>
> >That sounds well, but where do you store your properties file? I mean,
> >how do you switch from development properties file to production file?
> >
> >Pedro
> >
> >
> I load it from the classpath with getResourceAsStream(). Each server
> has its own version of the properties file at tomcat/shared/classes.
> Here's the guts of the code... I called it UserDefaults.java in memory
> of our old WebObjects apps. I don't doubt that a system property is the
> more java-proper way to do it.
>
>
> private static final String userDefaultsFilename = "user.defaults";
> private static Properties userDefaults;
>
> static {
> loadUserDefaults();
> }
>
> public static void loadUserDefaults()
> {
> userDefaults = new Properties();
> try {
> ClassLoader loader =
> Thread.currentThread().getContextClassLoader();
> InputStream input =
> loader.getResourceAsStream(userDefaultsFilename);
>
> userDefaults.load(input);
> }
> catch (NullPointerException npe) {
> System.out.println("No UserDefaults file found.);
> }
> catch (Exception ex) {
> throw new ExceptionAdapter(ex);
> }
> }
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]