问题
I am developing a Java EE application for JBoss 6.1.0 which needs to programmatically store image files on disk.
How/where should I store image files on a JBoss server?
回答1:
You can use the /standalone/data
folder for this, whose path is available via the jboss.server.data.dir
system property.
File dataDir = new File(System.getProperty("jboss.server.data.dir"));
File yourFile = new File(dataDir, "filename.ext");
// ...
You are even allowed to create subfolders in there. Below example creates /standalone/data/images
.
File imagesDir = new File(System.getProperty("jboss.server.data.dir"), "images");
imagesDir.mkdir();
File yourImageFile = new File(imagesDir, "image.png");
// ...
See also:
- JBoss directory structure
- JBoss system properties
- How to save uploaded file in JSF
来源:https://stackoverflow.com/questions/28081916/programmatically-storing-image-files-in-jboss