在JBoss中以编程方式存储图像文件 [英] Programmatically storing image files in JBoss
本文介绍了在JBoss中以编程方式存储图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为JBoss 6.1.0开发Java EE应用程序,该应用程序需要以编程方式在磁盘上存储映像文件.
I am developing a Java EE application for JBoss 6.1.0 which needs to programmatically store image files on disk.
如何在JBoss服务器上存储图像文件?
How/where should I store image files on a JBoss server?
推荐答案
您可以为此使用/standalone/data
文件夹,该文件夹的路径可通过jboss.server.data.dir
系统属性获得.
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");
// ...
您甚至可以在其中创建子文件夹.下面的示例创建/standalone/data/images
.
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");
// ...
另请参见:
- JBoss目录结构
- JBoss系统属性
- 如何在JSF中保存上传的文件
- JBoss directory structure
- JBoss system properties
- How to save uploaded file in JSF
See also:
这篇关于在JBoss中以编程方式存储图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文