Package org.mozilla.javascript

Examples of org.mozilla.javascript.Context.evaluateReader()


            global.init(cx);
            scope = cx.initStandardObjects(global);
            cx.evaluateReader(scope, new InputStreamReader(env.openConnection().getInputStream()), env.getFile(), 1, null);
            cx.evaluateString(scope, "lessenv.charset = '" + CHARSET + "';", "charset", 1, null);
            cx.evaluateString(scope, "lessenv.css = " + "true" + ";", "css", 1, null);
            cx.evaluateReader(scope, new InputStreamReader(less.openConnection().getInputStream()), less.getFile(), 1, null);
            cx.evaluateReader(scope, new InputStreamReader(engine.openConnection().getInputStream()), engine.getFile(), 1, null);
            compileString = (Function) scope.get("compileString", scope);
            compileFile = (Function) scope.get("compileFile", scope);
            Context.exit();
        } catch (Exception e) {
View Full Code Here


            scope = cx.initStandardObjects(global);
            cx.evaluateReader(scope, new InputStreamReader(env.openConnection().getInputStream()), env.getFile(), 1, null);
            cx.evaluateString(scope, "lessenv.charset = '" + CHARSET + "';", "charset", 1, null);
            cx.evaluateString(scope, "lessenv.css = " + "true" + ";", "css", 1, null);
            cx.evaluateReader(scope, new InputStreamReader(less.openConnection().getInputStream()), less.getFile(), 1, null);
            cx.evaluateReader(scope, new InputStreamReader(engine.openConnection().getInputStream()), engine.getFile(), 1, null);
            compileString = (Function) scope.get("compileString", scope);
            compileFile = (Function) scope.get("compileFile", scope);
            Context.exit();
        } catch (Exception e) {
            logger.error("LESS Engine intialization failed.", e);
View Full Code Here

            msgEntry.setAppContext("loadJsLib()");
            msgEntry.appendMessageText("Loading Rhino script " + scriptFile.getAbsolutePath());
            logger.logProcess(msgEntry);

            Reader scriptReader = new FileReader(scriptFile);
            ctxt.evaluateReader(scope, scriptReader, scriptFile.getAbsolutePath(), 1, null);
        }
        finally {
            Context.exit();
        }
    }
View Full Code Here

            msgEntry.setAppContext("executeScript()");
            msgEntry.appendMessageText("Executing Rhino JS script " + scriptFile.getAbsolutePath());
            logger.logProcess(msgEntry);

            Reader scriptReader = new FileReader(scriptFile);
            ctxt.evaluateReader(scope, scriptReader, scriptFile.getAbsolutePath(), 1, null);
        }
        finally {
            Context.exit();
        }
    }
View Full Code Here

    public void testRelativeId() throws Exception {
        final Context cx = createContext();
        final Scriptable scope = cx.initStandardObjects();
        final Require require = getSandboxedRequire(cx, scope, false);
        require.install(scope);
        cx.evaluateReader(scope, getReader("testRelativeId.js"),
                "testRelativeId.js", 1, null);
    }

    public void testSetMainForAlreadyLoadedModule() throws Exception {
        final Context cx = createContext();
View Full Code Here

    public void testSetMainForAlreadyLoadedModule() throws Exception {
        final Context cx = createContext();
        final Scriptable scope = cx.initStandardObjects();
        final Require require = getSandboxedRequire(cx, scope, false);
        require.install(scope);
        cx.evaluateReader(scope, getReader("testSetMainForAlreadyLoadedModule.js"),
                "testSetMainForAlreadyLoadedModule.js", 1, null);
        try {
            require.requireMain(cx, "assert");
            fail();
        }
View Full Code Here

        throws InterpreterException, IOException {

        Object rv = null;
        final Context ctx = enterContext();
        try {
            rv = ctx.evaluateReader(globalObject,
                                    scriptreader,
                                    description,
                                    1, rhinoClassLoader);
        } catch (JavaScriptException e) {
            // exception from JavaScript (possibly wrapping a Java Ex)
View Full Code Here

            logger.debug("Using implementation version: " + cx.getImplementationVersion());
            cx.setOptimizationLevel(9);
            Global global = new Global();
            global.init(cx);
            scope = cx.initStandardObjects(global);
            cx.evaluateReader(scope, new InputStreamReader(env.openConnection().getInputStream()), env.getFile(), 1, null);
            cx.evaluateString(scope, "lessenv.charset = '" + CHARSET + "';", "charset", 1, null);
            cx.evaluateString(scope, "lessenv.css = " + "false" + ";", "css", 1, null);
            cx.evaluateReader(scope, new InputStreamReader(less.openConnection().getInputStream()), less.getFile(), 1, null);
            cx.evaluateReader(scope, new InputStreamReader(engine.openConnection().getInputStream()), engine.getFile(), 1, null);
            compileString = (Function) scope.get("compileString", scope);
View Full Code Here

            global.init(cx);
            scope = cx.initStandardObjects(global);
            cx.evaluateReader(scope, new InputStreamReader(env.openConnection().getInputStream()), env.getFile(), 1, null);
            cx.evaluateString(scope, "lessenv.charset = '" + CHARSET + "';", "charset", 1, null);
            cx.evaluateString(scope, "lessenv.css = " + "false" + ";", "css", 1, null);
            cx.evaluateReader(scope, new InputStreamReader(less.openConnection().getInputStream()), less.getFile(), 1, null);
            cx.evaluateReader(scope, new InputStreamReader(engine.openConnection().getInputStream()), engine.getFile(), 1, null);
            compileString = (Function) scope.get("compileString", scope);
            compileFile = (Function) scope.get("compileFile", scope);
            Context.exit();
        } catch (Exception e) {
View Full Code Here

            scope = cx.initStandardObjects(global);
            cx.evaluateReader(scope, new InputStreamReader(env.openConnection().getInputStream()), env.getFile(), 1, null);
            cx.evaluateString(scope, "lessenv.charset = '" + CHARSET + "';", "charset", 1, null);
            cx.evaluateString(scope, "lessenv.css = " + "false" + ";", "css", 1, null);
            cx.evaluateReader(scope, new InputStreamReader(less.openConnection().getInputStream()), less.getFile(), 1, null);
            cx.evaluateReader(scope, new InputStreamReader(engine.openConnection().getInputStream()), engine.getFile(), 1, null);
            compileString = (Function) scope.get("compileString", scope);
            compileFile = (Function) scope.get("compileFile", scope);
            Context.exit();
        } catch (Exception e) {
            logger.error("LESS Engine intialization failed.", e);
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.