Package railo.transformer.util

Examples of railo.transformer.util.CFMLString


   * @return urls found in html String
   */
  public List getURLS(String html, URL url) {
   
      ArrayList urls=new ArrayList();
    CFMLString cfml=new CFMLString(html,"UTF-8");
    while(!cfml.isAfterLast()) {
      if(cfml.forwardIfCurrent('<')) {
        for(int i=0;i<tags.length;i++) {
          if(cfml.forwardIfCurrent(tags[i].tag+" ")) {
            getSingleUrl(urls,cfml,tags[i],url);
          }
        }
      }
      else {
        cfml.next();
      }
     
    }
    return urls;
  }
View Full Code Here


      String text=ASMUtil.getAttributeString(tag, "condition");

      try {
        ConfigImpl config=(ConfigImpl) ThreadLocalPageContext.getConfig();
        transformer = tagLib.getExprTransfomer();
        Expression expr=transformer.transform(ASMUtil.getAncestorPage(tag),null,flibs,config.getCoreTagLib().getScriptTags(),new CFMLString(text,"UTF-8"),TransfomerSettings.toSetting(ThreadLocalPageContext.getConfig(),null));
        tag.addAttribute(new Attribute(false,"condition",CastBoolean.toExprBoolean(expr),"boolean"));
      }
      catch (Exception e) {
        throw new EvaluatorException(e.getMessage());
      }
View Full Code Here

   * @throws TemplateException
   * @throws IOException
   */
  public Page transform(ConfigImpl config,SourceFile sf, TagLib[] tlibs, FunctionLib[] flibs) throws TemplateException, IOException  {
    Page p;
    CFMLString cfml;
   
    boolean writeLog=config.getExecutionLogEnabled();
    String charset=config.getTemplateCharset();
    boolean dotUpper = config.getDotNotationUpperCase();
   
   
    while(true){
      try {
        cfml=new CFMLString(sf,charset,writeLog);
        p = transform(config,cfml,tlibs,flibs,sf.getResource().lastModified(),dotUpper);
        break;
      }
      catch(ProcessingDirectiveException pde) {
        if(pde.getWriteLog()!=null)writeLog=pde.getWriteLog().booleanValue();
        if(pde.getDotNotationUpperCase()!=null)dotUpper=pde.getDotNotationUpperCase().booleanValue();
        if(!StringUtil.isEmpty(pde.getCharset()))charset=pde.getCharset();
      }
    }
   
    // if cfc has no component tag or is script without cfscript
    if(p.isPage() && ResourceUtil.getExtension(sf.getResource(),"").equalsIgnoreCase(config.getCFCExtension())){
      cfml.setPos(0);
      TagLibTag tlt;
      CFMLString original = cfml;
     
      // try inside a cfscript
      tlt = CFMLTransformer.getTLT(original,"script");
      String text="<"+tlt.getFullName()+">"+original.getText()+"</"+tlt.getFullName()+">";
      cfml=new CFMLString(text,charset,writeLog,sf);
     
      try {
        while(true){
          if(cfml==null){
            cfml=new CFMLString(sf,charset,writeLog);
            text="<"+tlt.getFullName()+">"+cfml.getText()+"</"+tlt.getFullName()+">";
            cfml=new CFMLString(text,charset,writeLog,sf);
          }
          try {
            p= transform(config,cfml,tlibs,flibs,sf.getResource().lastModified(),dotUpper);
            break;
          }
          catch(ProcessingDirectiveException pde) {
            if(pde.getWriteLog()!=null)writeLog=pde.getWriteLog().booleanValue();
            if(pde.getDotNotationUpperCase()!=null)dotUpper=pde.getDotNotationUpperCase().booleanValue();
            if(!StringUtil.isEmpty(pde.getCharset()))charset=pde.getCharset();
            cfml=null;
          }
        }
      }
      catch (ComponentTemplateException e) {
        throw e.getTemplateException();
      }
      catch (TemplateException e) {
        //print.printST(e);
      }
     
     
     
     
      // try inside a component
      if(p.isPage()){
        tlt = CFMLTransformer.getTLT(original,"component");
        text="<"+tlt.getFullName()+">"+original.getText()+"</"+tlt.getFullName()+">";
        cfml=new CFMLString(text,charset,writeLog,sf);
           
        while(true){
          if(cfml==null){
            cfml=new CFMLString(sf,charset,writeLog);
            text="<"+tlt.getFullName()+">"+cfml.getText()+"</"+tlt.getFullName()+">";
            cfml=new CFMLString(text,charset,writeLog,sf);
          }
          try {
            p= transform(config,cfml,tlibs,flibs,sf.getResource().lastModified(),dotUpper);
            break;
          }
View Full Code Here

     * <code>?-"*<!-- -->/";</code>
     * @return bool Wurde ein Kommentar entfernt?
     * @throws TemplateException
     */
    private boolean multiLineComment(ExprData data) throws TemplateException {
       CFMLString cfml = data.cfml;
      if(!cfml.forwardIfCurrent("/*")) return false;
        int pos=cfml.getPos();
        boolean isDocComment=cfml.isCurrent('*');
        while(cfml.isValidIndex()) {
            if(cfml.isCurrent("*/")) break;
            cfml.next();
        }
        if(!cfml.forwardIfCurrent("*/")){
            cfml.setPos(pos);
            throw new TemplateException(cfml,"comment is not closed");
        }
        if(isDocComment) {
          String comment = cfml.substring(pos-2,cfml.getPos()-pos);
          data.docComment=docCommentTransformer.transform(comment);
        }
        return true;
    }
View Full Code Here

   */
  public void run() throws TemplateException  {
    int size=v.size();
    for(int i=0;i<size;i++) {
      EvaluatorData ec=(EvaluatorData)v.elementAt(i);
      CFMLString cfml=ec.getCfml();
      cfml.setPos(ec.getPos());
      try {
        if(ec.getLibTag().getEvaluator()!=null)ec.getLibTag().getEvaluator().evaluate(
            ec.getTag(),
            ec.getLibTag(),
            ec.getFlibs());
View Full Code Here

   * @return transformed HTMl String
   * @throws PageException
   */
  public String transform(String html, URL url, boolean setBaseTag) throws PageException {
    StringBuffer target=new StringBuffer();
    CFMLString cfml=new CFMLString(html,"UTF-8");
    while(!cfml.isAfterLast()) {
      if(cfml.forwardIfCurrent('<')) {
        target.append('<');
        try {
          for(int i=0;i<tags.length;i++) {
            if(cfml.forwardIfCurrent(tags[i].tag+" ")) {
              target.append(tags[i].tag+" ");
              transformTag(target,cfml,tags[i],url);
            }
          }
        }
        catch(MalformedURLException me) {
          throw Caster.toPageException(me);
        }
      }
      else {
        target.append(cfml.getCurrent());
        cfml.next();
      }
     
    }
    if(!setBaseTag)return target.toString();
   
View Full Code Here

TOP

Related Classes of railo.transformer.util.CFMLString

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.