Package org.apache.commons.jexl2.introspection

Examples of org.apache.commons.jexl2.introspection.Sandbox.white()


        String expr = "new('" + Foo.class.getName() + "', '42')";
        Script script;
        Object result;

        Sandbox sandbox = new Sandbox();
        sandbox.white(Foo.class.getName()).execute("");
        Uberspect uber = new SandboxUberspectImpl(null, sandbox);
        JexlEngine sjexl = new JexlEngine(uber, null, null, null);
        sjexl.setStrict(true);

        script = sjexl.createScript(expr);
View Full Code Here


        String expr = "foo.Quux()";
        Script script;
        Object result;

        Sandbox sandbox = new Sandbox();
        sandbox.white(Foo.class.getName()).execute("Quux");
        Uberspect uber = new SandboxUberspectImpl(null, sandbox);
        JexlEngine sjexl = new JexlEngine(uber, null, null, null);
        sjexl.setStrict(true);

        script = sjexl.createScript(expr, "foo");
View Full Code Here

        String expr = "foo.alias";
        Script script;
        Object result;

        Sandbox sandbox = new Sandbox();
        sandbox.white(Foo.class.getName()).read("alias");
        sandbox.get(Foo.class.getName()).read().alias("alias", "ALIAS");
        Uberspect uber = new SandboxUberspectImpl(null, sandbox);
        JexlEngine sjexl = new JexlEngine(uber, null, null, null);
        sjexl.setStrict(true);
View Full Code Here

        String expr = "foo.alias = $0";
        Script script;
        Object result;

        Sandbox sandbox = new Sandbox();
        sandbox.white(Foo.class.getName()).write("alias");
        Uberspect uber = new SandboxUberspectImpl(null, sandbox);
        JexlEngine sjexl = new JexlEngine(uber, null, null, null);
        sjexl.setStrict(true);

        script = sjexl.createScript(expr, "foo", "$0");
View Full Code Here

    public void testRestrict() throws Exception {
        JexlContext context = new MapContext();
        context.set("System", System.class);
        Sandbox sandbox = new Sandbox();
        // only allow call to currentTimeMillis (avoid exit, gc, loadLibrary, etc)
        sandbox.white(System.class.getName()).execute("currentTimeMillis");
        // can not create a new file
        sandbox.black(java.io.File.class.getName()).execute("");

        Uberspect uber = new SandboxUberspectImpl(null, sandbox);
        JexlEngine sjexl = new JexlEngine(uber, null, null, null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.