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            @Override
032            public Query addQuery(String name, String[] column) {
033                    railo.runtime.type.Query query=new railo.runtime.type.QueryImpl(column,0,name);
034                    
035                    try {
036                            pc.setVariable(name,query);
037                    } 
038                    catch (PageException e) {
039                    }
040                    return new QueryWrap(query);
041            }
042    
043            @Override
044            public void setVariable(String key, String value) {
045                    try {
046                            pc.setVariable(key,value);
047                    } 
048                    catch (PageException e) {
049                    }
050            }
051    
052            @Override
053            public void write(String str) {
054                    try {
055                            pc.write(str);
056                    } catch (IOException e) {
057                            
058                    }
059            }
060    
061            @Override
062            public void writeDebug(String str) {
063                    if(debug)write(str);
064            }
065    
066    }