我们在一个web应用程序里面使用一个java库,它托管在apache server.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;
}
}
Run Code Online (Sandbox Code Playgroud)
是否允许从Web应用程序访问本地文件系统?如果是,那么是否有必须设置的访问权限?