File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Move a file in a WAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Move a file in a WAR " Watch "Move a file in a WAR " New topic

Move a file in a WAR

Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
I have piece of code that copies file in directory A to dirctory B of a WAR file on WebApplication startup. The code is in a listner class.
When i test it on local WSAD it works, but i am not sure whether it will run when deployed as WAR in WAS. The code creates an InputStream and OutputStream from the source and target files and copies the contents of file from source file to the target file. Can anyabody confirm this will work.

Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
I am not sure if websphere can run war files without unpackaging them (like tomcat can).
there is an unpacking work folder in websphere that some of our past projects the installation process was to honestly to deploy the war, stop websphere, edit property files that were in the newly created WEB-INF folder, within the deployed app, then restart websphere...
So things do get unpacked, and manipulating them in an unpacked state is possible.
Now there is still the issue if the target environment is configured differently, with directory permissions or a security policy that prevents the application from writing its folders.

Error: Keyboard not attached. Press F1 to continue.
I agree. Here's the link:
subject: Move a file in a WAR
It's not a secret anymore!