Package javax.script

Examples of javax.script.Bindings.entrySet()


        try {
          Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
         
          // initialize the Velocity context
          final VelocityContext c = new VelocityContext();
          for (Object entryObj : bindings.entrySet()) {
              Map.Entry<?, ?> entry = (Map.Entry<?, ?>) entryObj;
              c.put((String) entry.getKey(), entry.getValue());
          }
 
          // let Velocity evaluate the script, and send the output to the browser
View Full Code Here


      // set writer
      interp.setOut(scriptContext.getWriter());
      interp.setErr(scriptContext.getErrorWriter());
     
      // set all bindings
      for (Object entryObj : bindings.entrySet()) {
        Map.Entry<?, ?> entry = (Map.Entry<?, ?>) entryObj;
        interp.set((String) entry.getKey(), entry.getValue());
      }

      // execute Python code
View Full Code Here

            // setup the context for use
            rhinoContext.setWrapFactory(SlingWrapFactory.INSTANCE);

            // add initial properties to the scope
            for (Object entryObject : bindings.entrySet()) {
                Entry<?, ?> entry = (Entry<?, ?>) entryObject;
                Object wrapped = ScriptRuntime.toObject(scope, entry.getValue());
                ScriptableObject.putProperty(scope, (String) entry.getKey(),
                    wrapped);
            }
View Full Code Here

                        se.eval(p.getValue1(), bindings, language);

                        // re-assign graph bindings back to global bindings.  prevent assignment of non-graph
                        // implementations just in case someone tries to overwrite them in the init
                        bindings.entrySet().stream()
                                .filter(kv -> kv.getValue() instanceof Graph)
                                .forEach(kv -> this.globalBindings.put(kv.getKey(), kv.getValue()));

                        logger.info("Initialized {} ScriptEngine with {}", language, p.getValue0());
                    } catch (ScriptException sx) {
View Full Code Here

    static void preEval(ScriptingContainer container, ScriptContext context) {
        Object receiver = Utils.getReceiverObject(context);

        Bindings bindings = context.getBindings(ScriptContext.ENGINE_SCOPE);
        for (Map.Entry<String, Object> entry : bindings.entrySet()) {
            Utils.put(container, receiver, entry.getKey(), entry.getValue(), context);
        }
        try {
            //container.setReader(context.getReader());
            Utils.setWriter(container, context.getWriter());
View Full Code Here

       

        // if key of globalMap exists in engineMap, this key-value pair should be skipped.
        bindings = context.getBindings(ScriptContext.GLOBAL_SCOPE);
        if (bindings == null) return;
        for (Map.Entry<String, Object> entry : bindings.entrySet()) {
            if (container.getVarMap().containsKey(entry.getKey())) continue;
            Utils.put(container, receiver, entry.getKey(), entry.getValue(), context);
        }
    }
View Full Code Here

        Object receiver = Utils.getReceiverObject(context);

        Bindings engineMap = context.getBindings(ScriptContext.ENGINE_SCOPE);
        int size = engineMap.keySet().size();
        String[] names = engineMap.keySet().toArray(new String[size]);
        Iterator<Map.Entry<String, Object>> iter = engineMap.entrySet().iterator();
        for (;iter.hasNext();) {
            Map.Entry<String, Object> entry = iter.next();
            if (Utils.shouldLVarBeDeleted(container, entry.getKey())) {
                iter.remove();
            }
View Full Code Here

    static void preEval(ScriptingContainer container, ScriptContext context) {
        Object receiver = Utils.getReceiverObject(context);

        Bindings bindings = context.getBindings(ScriptContext.ENGINE_SCOPE);
        for (Map.Entry<String, Object> entry : bindings.entrySet()) {
            Utils.put(container, receiver, entry.getKey(), entry.getValue(), context);
        }
        try {
            //container.setReader(context.getReader());
            Utils.setWriter(container, context.getWriter());
View Full Code Here

       

        // if key of globalMap exists in engineMap, this key-value pair should be skipped.
        bindings = context.getBindings(ScriptContext.GLOBAL_SCOPE);
        if (bindings == null) return;
        for (Map.Entry<String, Object> entry : bindings.entrySet()) {
            if (container.getVarMap().containsKey(entry.getKey())) continue;
            Utils.put(container, receiver, entry.getKey(), entry.getValue(), context);
        }
    }
View Full Code Here

        Object receiver = Utils.getReceiverObject(context);

        Bindings engineMap = context.getBindings(ScriptContext.ENGINE_SCOPE);
        int size = engineMap.keySet().size();
        String[] names = engineMap.keySet().toArray(new String[size]);
        Iterator<Map.Entry<String, Object>> iter = engineMap.entrySet().iterator();
        for (;iter.hasNext();) {
            Map.Entry<String, Object> entry = iter.next();
            if (Utils.shouldLVarBeDeleted(container, entry.getKey())) {
                iter.remove();
            }
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.