我希望从同一项目中的 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/" 目录下的文件。请问如何访问?