I don't know the answer to that but we are already using commons configuration, 
which lets you write back to a properties file. So you could try that for your 
properties file too. 

Or use the db?

--K

On Apr 7, 2013, at 7:58, "Alex O'Ree" <[email protected]> wrote:

> I'm using the following code to read a file in META-INF
>  URL prop = application.getResource("/META-INF/config.properties");
>        if (prop == null) {
>            throw new Exception("Cannot locate the configuration file.");
>        }
>        session = _session;
>        propertiesurl = prop;
>        InputStream in = prop.openStream();
>        Properties p = new Properties();
>        p.load(in);
>        in.close();
> 
> This works in both tomcat and jboss.
> 
> Then later one, I want to be able to save the changes. Using code
> similar to this
> 
> FileOutputStream fos = new FileOutputStream(new 
> File(propertiesurl.toString()));
>        String msg="Edited at " + System.currentTimeMillis() + " by "
> + request.getRemoteUser();
>             p.store(fos, msg);
>        fos.close();
> 
> The propertiesurl.toString() method in tomcat returns a JNDI URL,
> which cannot be used using the file io api's. In Jboss, this code
> works just fine. Application.getResource returns a file:/// url.
> 
> So the question is, how can get the same type of setup in Tomcat?
> (write to a file in META-INF)

Reply via email to