I ususally save them in the always-present root-directory of the server. In my case I use the
variable which gives me the absolute path to the server dir on disk and work my way up. It's is not easy to use a sub-dir of your own application if you want to preserve the files, because Jboss creates a temporary dir where the deployed dir resides. If you don't care , get the absolute path from the servlet context. With Seam you just inject the FacesContext and you can get the absolute dir from there.
You can also take a look here which might be helpful. Personally I always put my files in the database. That way it is much easier to get hold of them.
I am able to get access to the root of webapp:
I can create files here, but seam/jboss is blocking my access. I get the error:
The url requested does not exist. Please update your saved bookmarks, or check that requested url is not mistyped.
Why can't I access generated files in the webapp directory???
To get a specific resource:
@In FacesContext facesContext; ... ServletContext ctx = (ServletContext) facesContext.getExternalContext().getContext(); URL url = ctx.getResource("/subDir/subDir/YourFile");
So if you place your file in the indicated YourFile starting from the root-directory of your application, it should work. However, if you use a WAR-file those files are created in a temporary deploy directory. When the server re-starts after a deploy you won't see the same directory. You can solve that by deploying as an WAR.DIR under your deploy directory. Your application will always atart in the same directory and your files are