Package java.io

Examples of java.io.FilePermission


            (File) servletContext.getAttribute(ServletContext.TEMPDIR);
        if (workDir != null) {
            try {
                String workDirPath = workDir.getCanonicalPath();
                classLoader.addPermission
                    (new FilePermission(workDirPath, "read,write"));
                classLoader.addPermission
                    (new FilePermission(workDirPath + File.separator + "-",
                                        "read,write,delete"));
            } catch (IOException e) {
                // Ignore
            }
        }
View Full Code Here


                }
                permission = new JndiPermission(path + "*");
                addPermission(permission);
            } else {
                if (!path.endsWith(File.separator)) {
                    permission = new FilePermission(path, "read");
                    addPermission(permission);
                    path = path + File.separator;
                }
                permission = new FilePermission(path + "-", "read");
                addPermission(permission);
            }
        }
    }
View Full Code Here

            (File) servletContext.getAttribute(ServletContext.TEMPDIR);
        if (workDir != null) {
            try {
                String workDirPath = workDir.getCanonicalPath();
                classLoader.addPermission
                    (new FilePermission(workDirPath, "read,write"));
                classLoader.addPermission
                    (new FilePermission(workDirPath + File.separator + "-",
                                        "read,write,delete"));
            } catch (IOException e) {
                // Ignore
            }
        }
View Full Code Here

   */
  public Connection(URL url)
  {
    super (url);

    permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
  }
View Full Code Here

    }
   
    public void engineSecured() throws Exception {
        Permissions perms = new Permissions();
        //we need to be able to read files and props so that the default module source provider can work
        perms.add(new FilePermission("<<ALL FILES>>", "read"));
        perms.add(new PropertyPermission("*", "read"));
       
        ScriptEngine eng = new JsEngineInitializer().instantiate(Collections.<String>emptySet(), perms);
       
        try {
View Full Code Here

        Permissions perms = new Permissions();
        perms.add(new RuntimePermission("createClassLoader"));
        perms.add(new RuntimePermission("getProtectionDomain"));

        //add permission to read files so that modules can be loaded, but writing should fail
        perms.add(new FilePermission("<<ALL FILES>>", "read"));

        ScriptEngine engine = initializer.instantiate(Collections.<String> emptySet(), perms);

        try {
            engine.eval("import os\nfp = open('pom.xml', 'w')");
View Full Code Here

        //allow the scripts to connect via sockets
        add(new SocketPermission("*", "connect,accept"));
       
        //allow access to the server's file system. let the file perms
        //guard what is writeable and what is not.
        add(new FilePermission("<<ALL FILES>>", "read,write,execute,delete"));
       
        //we don't suppose the serverside scripts to be malevolent, so let's
        //give them the read access to the system properties.
        add(new PropertyPermission("*", "read"));
       
View Full Code Here

            if (File.separatorChar != '/') {
                path = path.replace('/', File.separatorChar);
            }
            if (isDirectory(u)) {
                pc.add(new FilePermission(path + "-", "read"));
            } else {
                pc.add(new FilePermission(path, "read"));
            }
        } else {
            String host = u.getHost();
            if (host.length() == 0) {
                host = "localhost";
View Full Code Here

        if (permission == null) {
            String path = fileName;
            if (File.separatorChar != '/') {
                path = path.replace('/', File.separatorChar);
            }
            permission = new FilePermission(path, new String("read"));
        }
        return permission;
    }
View Full Code Here

   *
   * @param file
   *            the name of the file to check
   */
  public void checkDelete(String file) {
    checkPermission(new FilePermission(file, "delete"));
  }
View Full Code Here

TOP

Related Classes of java.io.FilePermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.