Web applications 嵌入式Jetty WebAppContext文件权限问题

Web applications 嵌入式Jetty WebAppContext文件权限问题,web-applications,servlets,jetty,file-permissions,embedded-jetty,Web Applications,Servlets,Jetty,File Permissions,Embedded Jetty,我需要限制嵌入式Jetty中包含servlet的“插件”WAR文件的文件权限。为了测试文件权限,我创建了一个WAR,其中包含尝试写入webapps文件夹之外的文件的servlet: public class Test extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException

我需要限制嵌入式Jetty中包含servlet的“插件”WAR文件的文件权限。为了测试文件权限,我创建了一个WAR,其中包含尝试写入webapps文件夹之外的文件的servlet:

public class Test extends HttpServlet
{
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        try
        {
            FileWriter outFile = new FileWriter("C:\\temp\\test.txt");
            PrintWriter out = new PrintWriter(outFile);
            out.println("This is line 1");
            out.println("This is line 2");
            out.close();
            response.getWriter().print("File created");
        }
        catch(Exception e)
        {
            response.getWriter().print(e.getMessage());
            e.printStackTrace();
        }

    }
}
包含此servlet的WAR随后添加到嵌入式Jetty处理程序中,并具有如下配置的文件权限:

jetty = new Server(serverPort);
handlers = new HandlerList();

...
(adding standard Web Apps here)
...

WebAppContext plugin = new WebAppContext();

//Create file permissions policy
PermissionCollection pcol = new Permissions();
FilePermission fp = new FilePermission(path_to_war, "read");
pcol.add(fp);
plugin.setPermissions(pcol);

plugin.setContextPath("/plugins/plugin_name");
plugin.setWar(path_to_war);
plugin.setCopyWebDir(false);
plugin.setCopyWebInf(false);
plugin.setExtractWAR(false);

handlers.addHandler(plugin);
jetty.setHandler(handlers);
jetty.start();
然而,servlet仍然能够创建和写入测试输出文件——我不确定为什么……我搜索了实现单个web应用程序特定权限的示例代码,但找到了关于这个主题的很少信息。我的猜测是WebAppContext“继承”了嵌入应用程序的文件权限策略

谁能给我指出正确的方向吗?谢谢大家!