Write files in a .war deployment

Hello,

Is there any way to write/change files inside a .war deployment? (like changing an xml document that is stored inside the .war file that is desployed on a tomcat server)

I can read files but can't seem to find any method for writing in it, since it always points to an absolute filepath which will not work.

thanks

[347 byte] By [radicjesa] at [2007-11-27 10:56:16]
# 1

Sure you can.

How are you calling the file?

Manuel Leiria

manuel.leiriaa at 2007-7-29 12:01:57 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hello thanks for your reply,

I am calling the file through the ClassLoader and getResourceAsStream() (this.getClass().getClassLoader().getResourceAsStream( "path" inside packages));

That way I can relatively read stuff inside the .war app no matter where it gets deployed.

But I have not found a way to write inside it, is there a similiar method? (or something totally different)

I have no problems writing in an absolute path (ie. /var/www/test/uploads), but for stuff like a small database xml caching file I would want to write inside the .war.

I hope you can provide me with an answer,

thanks

radicjesa at 2007-7-29 12:01:57 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...