Package org.mozilla.javascript

Examples of org.mozilla.javascript.Script.exec()


                        new NativeJavaPackage("java.net", loader),
                        new NativeJavaPackage("java.io", loader),
                    },
                    null);
            Script scriptObject = cx.compileReader(scope, getScriptReader(), "javascript", 1, null);
            scriptObject.exec(cx, scope);
            Object pico = scope.get("pico", scope);

            if (pico == null) {
                throw new NanoContainerMarkupException("The script must define a variable named 'pico'");
            }
View Full Code Here


            scope.setParentScope(null);

            for (Map.Entry<String, Object> entry : vars.entrySet()) {
                ScriptableObject.putProperty(scope, entry.getKey(), entry.getValue());
            }
            Object ret = script.exec(ctx, scope);
            return ScriptValueConverter.unwrapValue(ret);
        } finally {
            Context.exit();
        }
    }
View Full Code Here

      for( String name : properties.keySet() )
        ScriptableObject.putProperty( scope, name, Context.javaToJS( properties.get( name ), scope ) );

      Script script = context.compileString( scriptText, "Script", 0, null );

      return script.exec( context, scope );
    }
    finally
    {
      for( String name : properties.keySet() )
        scope.delete( name );
View Full Code Here

        throws Exception {
        org.mozilla.javascript.Context cx =
            org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();
        Script script = getInterpreter().compileScript(cx, filename);
        return script.exec( cx, scope );
    }

    /**
     * Setup an object so that it can access the information provided to regular components.
     * This is done by calling the various Avalon lifecycle interfaces implemented by the object, which
View Full Code Here

        throws Exception {
        org.mozilla.javascript.Context cx =
            org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();
        Script script = interpreter.compileScript( cx, filename );
        return script.exec( cx, scope );
    }   
       
    public static class FOM_Request extends ScriptableObject {

        Request request;
View Full Code Here

                ScriptSourceEntry entry =
                    (ScriptSourceEntry)compiledScripts.get(sourceURI);
                long lastMod = entry.getSource().getLastModified();
                Script script = entry.getScript(context, this.scope, false);
                if (lastExecTime == 0 || lastMod > lastExecTime) {
                    script.exec(context, thrScope);
                    thrScope.put(LAST_EXEC_TIME, thrScope,
                                 new Long(System.currentTimeMillis()));
                    ((ThreadScope)thrScope).reset();
                }
            }
View Full Code Here

                ScriptSourceEntry entry =
                    (ScriptSourceEntry)compiledScripts.get(sourceURI);
                long lastMod = entry.getSource().getLastModified();
                Script script = entry.getScript(context, this.scope, false, this);
                if (lastExecTime == 0 || lastMod > lastExecTime) {
                    script.exec(context, thrScope);
                    thrScope.put(LAST_EXEC_TIME, thrScope,
                                 new Long(System.currentTimeMillis()));
                    thrScope.reset();
                }
            }
View Full Code Here

        org.mozilla.javascript.Context cx =
                org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();

        Script script = getInterpreter().compileScript(cx, filename);
        return script.exec(cx, scope);
    }

    /**
     * Setup an object so that it can access the information provided to regular components.
     * This is done by calling the various Avalon lifecycle interfaces implemented by the object, which
View Full Code Here

            org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();
        Script script = getInterpreter().compileScript( cx,
                                                        getEnvironment(),
                                                        filename );
        return script.exec( cx, scope );
    }

    /**
     * Setup an object so that it can access the information provided to regular components.
     * This is done by calling the various Avalon lifecycle interfaces implemented by the object, which
View Full Code Here

                ScriptSourceEntry entry =
                    (ScriptSourceEntry)compiledScripts.get(sourceURI);
                long lastMod = entry.getSource().getLastModified();
                Script script = entry.getScript(context, this.scope, false, this);
                if (lastExecTime == 0 || lastMod > lastExecTime) {
                    script.exec(context, thrScope);
                    thrScope.put(LAST_EXEC_TIME, thrScope,
                                 new Long(System.currentTimeMillis()));
                    thrScope.reset();
                }
            }
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.