在Web服务上写入和读取文件(axis2 + tomcat 7) [英] write and read file on web service (axis2 + tomcat 7)

查看:89
本文介绍了在Web服务上写入和读取文件(axis2 + tomcat 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用应用程序的Java为Axis2 + Tomcat7.0编写服务.我选择将任何信息写入xml文件,问题是服务/应用程序服务器的根目录在哪里?

I'm writing a service for Axis2 + Tomcat7.0 with Java for the application. I've chosen to write any information to xml file, the problem is where is the root of the service/application server?

我阅读了

I read the other question but isn't response good.

如何通过服务获取指向可写目录的绝对路径?

How can I get an absolute path to the writable directory by the service?

推荐答案

我将设置一个环境变量,然后使用System.getProperty()读取其值.

I would set an environment variable and then read the value of it by using System.getProperty().

我认为默认的文件写入位置是启动服务器时的位置,至少这是我一次用JBoss找到的.最简单的方法是在服务器属性文件中设置环境变量,或者为服务创建属性文件以用于检索位置.我在Windows和Unix中都使用JBoss做到了这两种方式.

I think the default file writing location is wherever you are when you start the server, at least that's what I found with JBoss one time. The easiest thing is to either set an environment variable in a server property file, or create a property file for your service to use to retrieve the location. I've done it both ways with JBoss in windows and unix.

这篇关于在Web服务上写入和读取文件(axis2 + tomcat 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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