简体   繁体   English

在Web服务上写入和读取文件(axis2 + tomcat 7)

[英]write and read file on web service (axis2 + tomcat 7)

I'm writing a service for Axis2 + Tomcat7.0 with Java for the application. 我正在使用该应用程序的Java编写Axis2 + Tomcat7.0服务。 I've chosen to write any information to xml file, the problem is where is the root of the service/application server? 我选择将任何信息写入xml文件,问题是服务/应用程序服务器的根目录在哪里?

I read the other question but isn't response good. 我读了另一个问题,但回答不好。

How can I get an absolute path to the writable directory by the service? 我如何通过服务获取可写目录的绝对路径?

I would set an environment variable and then read the value of it by using System.getProperty(). 我将设置一个环境变量,然后使用System.getProperty()读取它的值。

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. 我认为默认的文件写入位置是启动服务器时的任何位置,至少这是我一次用JBoss找到的。 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. 我在Windows和Unix中都使用JBoss做到了这两种方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM