同じプロジェクト内のWebサービスのメソッドからWebContentフォルダ内のファイルにアクセスしたいとします。たとえば:WebサービスメソッドからWebContentフォルダにアクセスする方法
@WebMethod
public String test() {
File configFile = new File("config.xml");
return configFile.getAbsolutePath();
}
それは "/usr/share/glassfish3/glassfish/domains/domain1/config/config.xml" を返します。私は "/ usr/share/glassfish3/glassfish/domains/domain1/applications/my_project_name /"というディレクトリにあるファイルに行きたいと思っています。どうすればそれにアクセスできますか?
はhttp://stackoverflow.com/questions/6878275/how-get-the-を見ますbase-url –