Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.Value


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

    String method = options.get(env.createString("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

      if (! _streamReader.hasNext())
        return BooleanValue.FALSE;

      _lastNodeType = _currentNodeType;

      Value isEmptyElement = getIsEmptyElement();
     
      _currentNodeType = _streamReader.next();

      // php/4618
      if (isEmptyElement.toBoolean())
        return read(env);

      if (_currentNodeType == XMLStreamConstants.SPACE)
        return read(env);
View Full Code Here

      if (exploded == null)
        return null;

      String domain;

      Value domainValue = exploded.get(StringValue.create(":domain:"));

      if (domainValue.isNull())
        domain = "*";
      else
        domain = domainValue.toString();

      Hashtable<String, String> entries = new Hashtable<String, String>();

      for (Map.Entry<Value, Value> entry : exploded.entrySet()) {
        String key = entry.getKey().toString();
View Full Code Here

      int matches = 0;

      for (int i = 0; i < size; i++) {
        LongValue param = _preparedMapping.get(i);

        Value paramV = getParam(param.toInt()-1);

        if (paramV.equals(UnsetValue.UNSET)) {
          env.warning(L.l("Not all parameters are bound"));
          return false;
        }

        Object object = paramV.toJavaObject();

        setObject(i+1, object);
      }

      return executeStatement();
View Full Code Here

    Iterator<Map.Entry<Value,Value>> iter = array.getIterator(env);

    while (iter.hasNext()) {
      Map.Entry<Value,Value> entry = iter.next();

      Value key = entry.getKey();
      Value value = entry.getValue();

      if (key.isString())
        key = key.toUnicodeValue(env);

      if (value.isString())
        value = value.toUnicodeValue(env);

      copy.put(key, value);
    }

    return new ConstArrayValue(copy);
View Full Code Here

   */
  public Value get_html_translation_table(Env env,
                                          @Optional("HTML_SPECIALCHARS") int table,
                                          @Optional("ENT_COMPAT") int quoteStyle)
  {
    Value result;

    if (! env.isUnicodeSemantics()) {
      if (table == HTML_ENTITIES)
        result = HTML_ENTITIES_ARRAY.copy();
      else
        result = HTML_SPECIALCHARS_ARRAY.copy();
    }
    else {
      if (table == HTML_ENTITIES) {
        if (HTML_ENTITIES_ARRAY_UNICODE == null)
          HTML_ENTITIES_ARRAY_UNICODE = toUnicodeArray(env, HTML_ENTITIES_ARRAY);

        result = HTML_ENTITIES_ARRAY_UNICODE.copy();
      }
      else {
        if (HTML_SPECIALCHARS_ARRAY_UNICODE == null)
          HTML_SPECIALCHARS_ARRAY_UNICODE = toUnicodeArray(env, HTML_SPECIALCHARS_ARRAY);

        result = HTML_SPECIALCHARS_ARRAY_UNICODE.copy();
      }
    }

    if ((quoteStyle & ENT_HTML_QUOTE_SINGLE) != 0)
      result.put(env.createString('\''), env.createString("&#39;"));

    if ((quoteStyle & ENT_HTML_QUOTE_DOUBLE) != 0)
      result.put(env.createString('"'), env.createString("&quot;"));

    return result;
  }
View Full Code Here

          result.append(ch);
        }
        else if (ch == ';') {
          // If so substitute the entity and add it to result.
          StringValue entity = string.substring(htmlEntityStart, i + 1);
          Value value = htmlEntities.get(entity);
         
          if (value.isNull()) {
            result.append(entity);
          }
          else if (isUnicode) {
            result.append((char)value.toInt());           
          }
          else {
            out.write(result, (char)value.toInt());           
          }
         
          htmlEntityStart = -1;
        }
        else if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) {         
View Full Code Here

     
    zone.put("offset", offset);
    zone.put("timezone_id", tz.getID());
   
    String name = tz.getDisplayName(isDST, TimeZone.SHORT);
    Value nameV = StringValue.create(name.toLowerCase());
   
    Value zones = array.get(nameV);
   
    if (zones.isNull()) {
      zones = new ArrayValueImpl();
     
      array.put(nameV, zones);
    }
   
    zones.put(zone);
  }
View Full Code Here

    // Can't use TimeZone.getTimeZone() because that function returns
    // GMT timezone by default if not found
   
    ArrayValue array = listAbbreviations();
   
    Value zones = array.get(abbr.toLowerCase());

    if (zones.isset())
      return zones.get(LongValue.ZERO).get(StringValue.create("timezone_id"));
    else
      return BooleanValue.FALSE;
  }
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.