Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.Value


   *
   * @return the expression value.
   */
  public Value evalArray(Env env)
  {
    Value obj = env.getThis();

    if (obj.isNull())
      return cannotUseThisError(env);
   
    return obj.getThisFieldArray(env, _name);
  }
View Full Code Here


   *
   * @return the expression value.
   */
  public Value evalObject(Env env)
  {
    Value obj = env.getThis();

    if (obj.isNull())
      return cannotUseThisError(env);
   
    return obj.getThisFieldObject(env, _name);
  }
View Full Code Here

   *
   * @return the expression value.
   */
  public void evalUnset(Env env)
  {
    Value obj = env.getThis();

    if (obj.isNull())
      cannotUseThisError(env);
   
    obj.unsetThisField(_name);
  }
View Full Code Here

    _path = path;
   
    _lineReader = new LineReader(env);
   
    if (context != null) {
      Value options
      = context.getOptions().get(env.createStringOld(path.getScheme()));

    String method = options.get(env.createStringOld("method")).toString();
   
    if (method.equals("POST")){
      ReadWritePair pair = path.openReadWrite();
      _is = pair.getReadStream();
      _os = pair.getWriteStream();
View Full Code Here

    while (iter.hasNext()) {
      Map.Entry<Value,Value> entry = iter.next();
   
      String optionName = entry.getKey().toString();
      Value optionValue = entry.getValue();

      if (optionName.equals("method"))
        _httpStream.setMethod(optionValue.toString());
      else if (optionName.equals("header")) {
        String option = optionValue.toString();
       
        int start = 0;
        int len = option.length();
       
        while (start < len) {
          int end = option.indexOf("\r\n", start);

          if (end < 0)
            end = len;
         
          int i = option.indexOf(':', start);
         
          if (i < 0 || i > end) {
            _httpStream.setAttribute(option.substring(start, end), "");
           
            break;
          }
          else {
            String name = option.substring(start, i);
            String value = option.substring(i + 1, end).trim();

            _httpStream.setAttribute(name, value);
          }
         
          start = end += 2;
        }
      }
      else if (optionName.equals("user_agent"))
        _httpStream.setAttribute("User-Agent", optionValue.toString());
      else if (optionName.equals("content"))
        _bodyStart = optionValue.toBinaryValue(env).toBytes();
      else if (optionName.equals("proxy"))
        env.stub("StreamContextResource::proxy option");
      else if (optionName.equals("request_fulluri"))
        env.stub("StreamContextResource::request_fulluri option");
      else if (optionName.equals("protocol_version")) {
        double version = optionValue.toDouble();
       
        if (version == 1.1) {
        }
        else if (version == 1.0)
          _httpStream.setHttp10();
        else
          env.stub("StreamContextResource::protocol_version " + version);
      }
      else if (optionName.equals("timeout")) {
        long ms = (long) optionValue.toDouble() * 1000;
        _httpStream.setSocketTimeout(ms);
      }
      else if (optionName.equals("ignore_errors"))
        env.stub("ignore_errors::ignore_errors option");
      else
View Full Code Here

    super(left, right);
  }

  public Value eval(Env env)
  {
    Value lValue = _left.eval(env);
    Value rValue = _right.eval(env);

    return lValue.add(rValue);
  }
View Full Code Here

  /**
   * Evaluates the equality as a boolean.
   */
  public boolean evalBoolean(Env env)
  {
    Value lValue = _left.eval(env);
    Value rValue = _right.eval(env);

    return lValue.gt(rValue);
  }
View Full Code Here

    Value []values = new Value[_args.length];

    for (int i = 0; i < values.length; i++)
      values[i] = _args[i].eval(env);

    Value obj = env.getThis();
    env.pushCall(this, obj, values);

    try {
      env.checkTimeout();
View Full Code Here

   *
   * @return the expression value.
   */
  public Value eval(Env env)
  {
    Value lValue = _left.eval(env);
    Value rValue = _right.eval(env);

    return lValue.bitAnd(rValue);
  }
View Full Code Here

              WriteStream ws = new WriteStream(writer);
             
              Env env = quercus.createEnv(page, ws, deliveryContext.getHttpServletRequest(), deliveryContext.getHttpServletResponse());
              env.start();
                         
              Value value = page.executeTop(env);
              ws.flush();

              String output = ((StringWriter)ws.getSource()).getString();           
             
              Object returnObject = value.toJavaObject();
 
              //logger.info("output:" + output);
          pw.println(output);
        }
        catch (Throwable e)
        {
          e.printStackTrace();
      }
    }
      else if(scriptController != null)
      {
        scriptController.getRequest().setAttribute("org.infoglue.cms.deliver.scriptLogic", scriptController);
        scriptController.getRequest().setAttribute("org.infoglue.cms.deliver.portalLogic", portletController);
        scriptController.getRequest().setAttribute("model", model);
        try
        {
          QuercusContext quercus = new QuercusContext();
          quercus.setServletContext(scriptController.getRequest().getSession().getServletContext());
          Path pwd = new FilePath(CmsPropertyHandler.getContextRootPath());
          quercus.setPwd(pwd);
          if (! Alarm.isTest() && ! quercus.isResin()) {
            Vfs.setPwd(pwd);
            WorkDir.setLocalWorkDir(pwd.lookup("WEB-INF/work"));
          }

          quercus.init();
          quercus.start();
         
              StringWriter writer = new StringWriter(new CharBuffer(1024));
              writer.openWrite();
             
              ByteArrayInputStream bais = new ByteArrayInputStream(templateAsString.getBytes());
              VfsStream stream = new VfsStream(bais, null);       
              QuercusPage page = quercus.parse(new ReadStream(stream));
             
              WriteStream ws = new WriteStream(writer);
             
              Env env = quercus.createEnv(page, ws, scriptController.getRequest(), scriptController.getResponse());
              env.start();
                         
              Value value = page.executeTop(env);
              ws.flush();

              String output = ((StringWriter)ws.getSource()).getString();           
             
              Object returnObject = value.toJavaObject();
 
              //logger.info("output:" + output);
          pw.println(output);
        }
        catch (Throwable e)
View Full Code Here

TOP

Related Classes of com.caucho.quercus.env.Value

Copyright © 2018 www.massapicom. 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.