/** {@inheritDoc} */ public Object eval(Reader reader, Bindings bindings) throws ScriptException{ return eval(reader,getScriptContext(bindings)); }
/** {@inheritDoc} */ public Object eval(Reader reader) throws ScriptException{ return eval(reader, context); }
/** {@inheritDoc} */ public void put(String key, Object value) { if (key == null) { throw new NullPointerException("name is null"); } if (key.length() == 0) { throw new IllegalArgumentException("name is empty"); } getBindings(ScriptContext.ENGINE_SCOPE).put(key,value); }
public HttlScriptEngine(ScriptEngineFactory factory, Engine engine) { this.factory = factory; this.engine = engine; super.setContext(new HttlScriptContext()); }
public Object eval(Reader reader) throws ScriptException { return eval(reader, context); }
/** {@inheritDoc} */ public Object get(String key) { return getBindings(ScriptContext.ENGINE_SCOPE).get(key); }
public Object eval(String script, Bindings bindings) throws ScriptException { return eval(script, getScriptContext(bindings)); }
public Object eval(String script) throws ScriptException { return eval(script, context); }
/** * Returns a {@link SimpleScriptContext} which: * <ul> * <li>uses the specified {@link Bindings} as the {@link ScriptEngine#ENGINE_SCOPE}</li> * <li>has the same GLOBAL_SCOPE Bindings as the current context</li> * <li>uses the same Reader, Writer and Error Writer as the current context</li> * </ul> * * @param bindings the bindings to be associated with ENGINE_SCOPE * @return an instance of SimpleScriptContext * * @throws NullPointerException if bindings is <tt>null</tt> */ protected ScriptContext getScriptContext(Bindings bindings){ if (bindings == null) { throw new NullPointerException("ENGINE_SCOPE bindings cannot be null"); } ScriptContext scriptContext = new SimpleScriptContext(); scriptContext.setBindings(bindings, ScriptContext.ENGINE_SCOPE); scriptContext.setBindings(this.getBindings(ScriptContext.GLOBAL_SCOPE), ScriptContext.GLOBAL_SCOPE); scriptContext.setReader(this.context.getReader()); scriptContext.setWriter(this.context.getWriter()); scriptContext.setErrorWriter(this.context.getErrorWriter()); return scriptContext; }
/** {@inheritDoc} */ public Object eval(String script, Bindings bindings) throws ScriptException{ return eval(script,getScriptContext(bindings)); }
/** {@inheritDoc} */ public Object eval(String script) throws ScriptException{ return eval(script, context); }
public Object eval(Reader reader, Bindings bindings) throws ScriptException { return eval(reader, getScriptContext(bindings)); }