我们在托管在apache服务器中的Web应用程序中使用Java库。库中的ReadConfFile方法返回文件未找到错误。方法如下
public byte[] ReadConfFile()
{
try
{
File file = new File("/home/product/api/conf.txt");
if(!file.exists())
return "file not found".getBytes();
byte[] buf = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(buf);
return buf;
} catch (IOException e)
{
e.printStackTrace();
return null;
}
}
是否允许从 Web 应用程序访问本地文件系统?如果是,那么是否需要设置任何访问权限?