在JBoss中以编程方式存储图像文件 [英] Programmatically storing image files in JBoss

查看:142
本文介绍了在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");
// ...

另请参见:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆