001 package railo.runtime.tag; 002 003 import railo.runtime.cfx.CFXTagException; 004 import railo.runtime.cfx.CFXTagPool; 005 import railo.runtime.cfx.RequestImpl; 006 import railo.runtime.cfx.ResponseImpl; 007 import railo.runtime.exp.PageException; 008 import railo.runtime.ext.tag.AppendixTag; 009 import railo.runtime.ext.tag.DynamicAttributes; 010 import railo.runtime.ext.tag.TagImpl; 011 import railo.runtime.op.Caster; 012 import railo.runtime.type.Struct; 013 import railo.runtime.type.StructImpl; 014 015 import com.allaire.cfx.CustomTag; 016 import com.allaire.cfx.Request; 017 import com.allaire.cfx.Response; 018 019 /** 020 * Creates a CFML CFX Tag 021 * 022 * 023 * 024 **/ 025 public final class CFXTag extends TagImpl implements DynamicAttributes,AppendixTag { 026 027 private Struct attributes=new StructImpl(); 028 private String appendix; 029 030 /** 031 * @see javax.servlet.jsp.tagext.Tag#release() 032 */ 033 public void release() { 034 attributes.clear(); 035 appendix=null; 036 } 037 038 /** 039 * @param appendix The appendix to set. 040 */ 041 public void setAppendix(String appendix) { 042 //print.out(appendix); 043 this.appendix = appendix; 044 } 045 046 /** 047 * @see railo.runtime.ext.tag.DynamicAttributes#setDynamicAttribute(java.lang.String, java.lang.String, java.lang.Object) 048 */ 049 public void setDynamicAttribute(String domain, String key, Object value) { 050 attributes.setEL(key,value); 051 } 052 053 /** 054 * @see javax.servlet.jsp.tagext.Tag#doStartTag() 055 */ 056 public int doStartTag() throws PageException { 057 // RR SerialNumber sn = pageContext.getConfig().getSerialNumber(); 058 // if(sn.getVersion()==SerialNumber.VERSION_COMMUNITY) 059 // throw new SecurityException("no access to this functionality with the "+sn.getStringVersion()+" version of railo"); 060 061 062 CFXTagPool pool=pageContext.getConfig().getCFXTagPool(); 063 CustomTag ct; 064 try { 065 ct = pool.getCustomTag(appendix); 066 } 067 catch (CFXTagException e) { 068 throw Caster.toPageException(e); 069 } 070 Request req=new RequestImpl(pageContext,attributes); 071 Response rsp=new ResponseImpl(pageContext,req.debug()); 072 try { 073 ct.processRequest(req,rsp); 074 } catch (Exception e) { 075 throw Caster.toPageException(e); 076 } 077 pool.releaseCustomTag(ct); 078 079 return SKIP_BODY; 080 } 081 082 public String getAppendix() { 083 return appendix; 084 } 085 }