On 5 Dec 2010, at 19:20, Christopher Schultz
<ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Pid,
>
> On 12/4/2010 5:07 PM, Pid wrote:
>> On 12/4/10 5:41 PM, Mark Eggers wrote:
>>> Read about using properties files. They're typically called 
>>> <name>.properties.
>>>
>>> Snippet of code that can be placed in a ServletContextListener.
>>>
>>> String resource = "some.properties";
>>> InputStream in = 
>>> this.getClass().getClassLoader().getResourceAsStream(resource);
>>> try {
>>>     props.load(in);
>>>     in.close();
>>>    } catch (IOException ex) {
>>>          ex.printStackTrace(); // ugly
>>>    }
>>>
>>> Note that this is not a complete ServletContextListener. Normally I create a
>>> separate class, have that class's constructor read the properties file, and 
>>> then
>>> use the ServletContextListener to create a servlet context attribute with 
>>> the
>>> information.
>>
>> You can use: ServletContext.getResourceAsStream()
>
> It's probably better to use ServletContext.getResource() (returns a URL)
> because then you might be able check it's last modified date.

I didn't know commons conf did runtime changes.  Fair point about URL.


p


>
> I haven't tried it, but a JarURLConnection might be nice enough to
> properly implement the getLastModifiedDate method.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkz75cMACgkQ9CaO5/Lv0PDfcgCeL1INqRVJTR/DrfqtbT4pJfXL
> VQUAoJ1PXqDjDpVL8NiTz+079TeoNtL3
> =f5Cd
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to