001 package railo.runtime.cfx; 002 003 import java.io.IOException; 004 005 import railo.runtime.PageContext; 006 import railo.runtime.exp.PageException; 007 008 import com.allaire.cfx.Query; 009 import com.allaire.cfx.Response; 010 011 012 013 /** 014 * 015 */ 016 public final class ResponseImpl implements Response { 017 018 private PageContext pc; 019 private boolean debug; 020 021 022 /** 023 * @param pc 024 * @param debug 025 */ 026 public ResponseImpl(PageContext pc,boolean debug) { 027 this.pc=pc; 028 this.debug=debug; 029 } 030 031 /** 032 * @see com.allaire.cfx.Response#addQuery(java.lang.String, java.lang.String[]) 033 */ 034 public Query addQuery(String name, String[] column) { 035 railo.runtime.type.Query query=new railo.runtime.type.QueryImpl(column,0,name); 036 037 try { 038 pc.setVariable(name,query); 039 } 040 catch (PageException e) { 041 } 042 return new QueryWrap(query); 043 } 044 045 /** 046 * @see com.allaire.cfx.Response#setVariable(java.lang.String, java.lang.String) 047 */ 048 public void setVariable(String key, String value) { 049 try { 050 pc.setVariable(key,value); 051 } 052 catch (PageException e) { 053 } 054 } 055 056 /** 057 * @see com.allaire.cfx.Response#write(java.lang.String) 058 */ 059 public void write(String str) { 060 try { 061 pc.write(str); 062 } catch (IOException e) { 063 064 } 065 } 066 067 /** 068 * @see com.allaire.cfx.Response#writeDebug(java.lang.String) 069 */ 070 public void writeDebug(String str) { 071 if(debug)write(str); 072 } 073 074 }