permaculture playing cards
The moose likes JBoss/WildFly and the fly likes Saving files in WAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Saving files in WAR file" Watch "Saving files in WAR file" New topic

Saving files in WAR file

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Hello, I have a simple JBOSS war application, ie. a war file which is a web application. I want to be able to create simple html files inside the WAR file. But i want the files to be accessible from a browser. So that we can say,


My question is? I am using the java code:

File f = new File ("bleh.html");

What should I use to prefix bleh.html, because currently, the file is being saved to the bin directory of JBOSS. Thanks.
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
You only would need to store file files under the web root folder for them to be available to a browser. I wouldn't worry too much about how JBoss deploys the files.... Just make your directory structure match the J2EE spec and you're going to be fine. In other words, if your web root is myapp, then inside your war file, you would have myapp/blah.html, and it would be reachable on http://localhost:8080/myapp/blah.html
I agree. Here's the link:
subject: Saving files in WAR file
It's not a secret anymore!