Package railo.runtime.type

Examples of railo.runtime.type.StructImpl


* @return return a struct with all section an dkey list as value
* @throws IOException
*/
public static Struct getProfileSections(Resource file) throws IOException {
     IniFile ini=new IniFile(file);
     Struct rtn=new StructImpl(Struct.TYPE_SYNC);
     Map sections = ini.getSections();
     Iterator it = sections.keySet().iterator();
     while(it.hasNext()) {
         String strSection=(String) it.next();
         Map section = ini.getSectionEL(strSection);
         Iterator iit = section.keySet().iterator();
         StringBuilder sb=new StringBuilder();
         while(iit.hasNext()) {
             if(sb.length()!=0)sb.append(',');
             sb.append(iit.next());
         }
         rtn.setEL(strSection,sb.toString());
     }
     return rtn;
}
View Full Code Here


        used+=usage.getUsed();
        max+=usage.getMax();
        init+=usage.getInit();
      }
    }
    Struct sct=new StructImpl();
    sct.setEL(KeyConstants._used, Caster.toDouble(used));
    sct.setEL(KeyConstants._max, Caster.toDouble(max));
    sct.setEL(KeyConstants._init, Caster.toDouble(init));
    sct.setEL(KeyImpl.init("available"), Caster.toDouble(max-used));
    return sct;
  }
View Full Code Here

    Iterator<MemoryPoolMXBean> it = manager.iterator();
   
    MemoryPoolMXBean bean;
    MemoryUsage usage;
    MemoryType _type;
    Struct sct=new StructImpl();
    while(it.hasNext()){
      bean = it.next();
      usage = bean.getUsage();
      _type = bean.getType();
      if(type==MEMORY_TYPE_HEAP && _type!=MemoryType.HEAP)continue;
      if(type==MEMORY_TYPE_NON_HEAP && _type!=MemoryType.NON_HEAP)continue;
       
      double d=((int)(100D/usage.getMax()*usage.getUsed()))/100D;
      sct.setEL(KeyImpl.init(bean.getName()), Caster.toDouble(d));
    }
    return sct;
  }
View Full Code Here

    setParam(hpb);
  }

  @Override
  public int doEndTag() throws PageException {
      Struct cfhttp=new StructImpl();
    cfhttp.setEL(ERROR_DETAIL,"");
    pageContext.setVariable(result,cfhttp);

    // because commons
    PrintStream out = System.out;
        try {
View Full Code Here

      cfhttp.set(HTTP_VERSION,(httpMethod.getStatusLine().getHttpVersion()));
     
    //responseHeader
      Header[] headers = httpMethod.getResponseHeaders();
      StringBuffer raw=new StringBuffer(httpMethod.getStatusLine().toString()+" ");
      Struct responseHeader = new StructImpl();
      Array setCookie = new ArrayImpl();
     
          for(int i=0;i<headers.length;i++) {
            Header header=headers[i];
            //print.ln(header);
           
            raw.append(header+" ");
            if(header.getName().equalsIgnoreCase("Set-Cookie"))
              setCookie.append(header.getValue());
            else {
                //print.ln(header.getName()+"-"+header.getValue());
              Object value=responseHeader.get(KeyImpl.getInstance(header.getName()),null);
              if(value==null) responseHeader.set(KeyImpl.getInstance(header.getName()),header.getValue());
              else {
                  Array arr=null;
                  if(value instanceof Array) {
                      arr=(Array) value;
                  }
                  else {
                      arr=new ArrayImpl();
                      responseHeader.set(KeyImpl.getInstance(header.getName()),arr);
                      arr.appendEL(value);
                  }
                  arr.appendEL(header.getValue());
              }
            }
           
            // Content-Type
            if(header.getName().equalsIgnoreCase("Content-Type")) {
              mimetype=header.getValue();
              if(mimetype==null)mimetype=NO_MIMETYPE;
            }
           
            // Content-Encoding
            if(header.getName().equalsIgnoreCase("Content-Encoding")) {
              contentEncoding=header.getValue();
            }
           
          }
          cfhttp.set(RESPONSEHEADER,responseHeader);
          responseHeader.set(STATUS_CODE,new Double(httpMethod.getStatusCode()));
          responseHeader.set(EXPLANATION,(httpMethod.getStatusText()));
          if(setCookie.size()>0)responseHeader.set(SET_COOKIE,setCookie);
         
      // is text
          boolean isText=
            mimetype == null || 
            mimetype == NO_MIMETYPE || HTTPUtil.isTextMimeType(mimetype);
View Full Code Here

    cfhttp.setEL(CHARSET,"");
    cfhttp.setEL(ERROR_DETAIL,"Unknown host: "+t.getMessage());
    cfhttp.setEL(FILE_CONTENT,"Connection Failure");
    cfhttp.setEL(HEADER,"");
    cfhttp.setEL(MIME_TYPE,"Unable to determine MIME type of file.");
    cfhttp.setEL(RESPONSEHEADER,new StructImpl());
    cfhttp.setEL(STATUSCODE,"Connection Failure. Status code unavailable.");
    cfhttp.setEL(TEXT,Boolean.TRUE);
  }
View Full Code Here

    cfhttp.setEL(CHARSET,"");
    cfhttp.setEL(ERROR_DETAIL,"");
    cfhttp.setEL(FILE_CONTENT,"Connection Timeout");
    cfhttp.setEL(HEADER,"");
    cfhttp.setEL(MIME_TYPE,"Unable to determine MIME type of file.");
    cfhttp.setEL(RESPONSEHEADER,new StructImpl());
    cfhttp.setEL(STATUSCODE,"408 Request Time-out");
    cfhttp.setEL(STATUS_CODE,new Double(408));
    cfhttp.setEL(STATUS_TEXT,"Request Time-out");
    cfhttp.setEL(TEXT,Boolean.TRUE);
  }
View Full Code Here

  public int doEndTag()  {
    return EVAL_PAGE;
  }

  private Struct toStruct(IndexResult result) {
    Struct sct=new StructImpl();
    sct.setEL("deleted",new Double(result.getCountDeleted()));
    sct.setEL("inserted",new Double(result.getCountInserted()));
    sct.setEL("updated",new Double(result.getCountUpdated()));
    return sct;
  }
View Full Code Here

     * @param client
     * @return FTPCLient
     * @throws PageException
     */
    private Struct writeCfftp(FTPClient client) throws PageException  {
        Struct cfftp=new StructImpl();
        if(result==null)pageContext.variablesScope().setEL(CFFTP,cfftp);
        else pageContext.setVariable(result,cfftp);
        if(client==null) {
            cfftp.setEL(SUCCEEDED,Boolean.FALSE);
            cfftp.setEL(ERROR_CODE,new Double(-1));
            cfftp.setEL(ERROR_TEXT,"");
            cfftp.setEL(RETURN_VALUE,"");
            return cfftp;
        }
        int repCode = client.getReplyCode();
        String repStr=client.getReplyString();
        cfftp.setEL(ERROR_CODE,new Double(repCode));
        cfftp.setEL(ERROR_TEXT,repStr);
       
        cfftp.setEL(SUCCEEDED,Caster.toBoolean(FTPReply.isPositiveCompletion(repCode)));
        cfftp.setEL(RETURN_VALUE,repStr);
        return cfftp;
    }
View Full Code Here

          return null;
         
    paramsStr = paramsStr.substring(1, paramsStr.length() - 1);
    String items[] = ListUtil.listToStringArray(paramsStr, ',');
   
    Struct params=new StructImpl();
    String arr$[] = items;
    int index;
        for(int i = 0; i < arr$.length; i++)  {
            String pair = arr$[i];
            index = pair.indexOf('=');
            if(index == -1) return null;
           
            params.setEL(
                KeyImpl.init(deleteQuotes(pair.substring(0, index).trim()).trim()),
                deleteQuotes(pair.substring(index + 1).trim()));
        }

        return params;
View Full Code Here

TOP

Related Classes of railo.runtime.type.StructImpl

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.