001 package railo.runtime.tag; 002 003 import railo.runtime.exp.PageException; 004 import railo.runtime.ext.tag.TagImpl; 005 import railo.runtime.functions.dynamicEvaluation.Evaluate; 006 import railo.runtime.op.Caster; 007 008 /** 009 * Outputs variables for debugging purposes. Using cfdump, you can display the contents of simple variables, queries, 010 * arrays, structures, and WDDX variables created with cfwddx. if no var attribute defined it dump the hole site information 011 * 012 * 013 * 014 **/ 015 public final class Dump extends TagImpl { 016 017 018 /** Variable to display. Enclose a variable name in pound signs */ 019 private Object var; 020 021 /** Name of Variable to display */ 022 private Object eval; 023 024 /** string; header for the dump output. */ 025 private String label; 026 private String format; 027 private String output; 028 //private double maxlevel=Integer.MAX_VALUE; 029 030 private boolean expand=true; 031 032 private int top=9999; 033 private String hide; 034 private String show; 035 036 private double keys=9999; 037 private boolean showUDFs=true; 038 039 private boolean metainfo=true; 040 private boolean abort=false; 041 042 043 /** 044 * @see javax.servlet.jsp.tagext.Tag#release() 045 */ 046 public void release() { 047 super.release(); 048 var=null; 049 eval=null; 050 label=null; 051 //maxlevel=Integer.MAX_VALUE; 052 format=null; 053 output=null; 054 expand=true; 055 top=9999; 056 hide=null; 057 show=null; 058 keys=9999; 059 metainfo=true; 060 showUDFs=true; 061 abort=false; 062 } 063 064 065 066 /** 067 * @param top the top to set 068 */ 069 public void setTop(double top) { 070 this.top = (int) top+1; 071 } 072 public void setHide(String hide) { 073 this.hide = hide; 074 } 075 public void setShow(String show) { 076 this.show = show; 077 } 078 public void setOutput(String output) { 079 this.output = output; 080 } 081 public void setKeys(double keys) { 082 this.keys = keys; 083 } 084 public void setMetainfo(boolean metainfo) { 085 this.metainfo = metainfo; 086 } 087 088 089 090 /** set the value expand 091 * not supported at the moment 092 * @param expand value to set 093 **/ 094 public void setExpand(boolean expand) { 095 this.expand=expand; 096 } 097 098 /** set the value var 099 * Variable to display. Enclose a variable name in pound signs 100 * @param var value to set 101 **/ 102 public void setVar(Object var) { 103 this.var=var; 104 } 105 106 /** set the value eval 107 * Variable to display. Enclose a variable name in pound signs 108 * @param eval value to set 109 **/ 110 public void setEval(Object eval) { 111 this.eval=eval; 112 } 113 114 /** set the value label 115 * string; header for the dump output. 116 * @param label value to set 117 **/ 118 public void setLabel(String label) { 119 this.label=label; 120 } 121 122 /** 123 * @param maxlevel the maxlevel to set 124 */ 125 public void setMaxlevel(double maxlevel) { 126 this.top = (int) maxlevel; 127 } 128 129 /** 130 * @param type the type to set 131 */ 132 public void setType(String type) { 133 this.format = type; 134 } 135 public void setFormat(String format) { 136 this.format = format; 137 } 138 139 140 /** 141 * @see javax.servlet.jsp.tagext.Tag#doStartTag() 142 */ 143 public int doStartTag() throws PageException { 144 if(var==null && eval!=null) { 145 var=Evaluate.call(pageContext,new Object[]{eval}); 146 if(label==null)label=Caster.toString(eval); 147 } 148 149 railo.runtime.functions.other.Dump.call(pageContext,var,label,expand,top,show,hide,output,format,keys,metainfo,showUDFs); 150 if(abort)throw new railo.runtime.exp.Abort(railo.runtime.exp.Abort.SCOPE_REQUEST); 151 return SKIP_BODY; 152 } 153 154 /** 155 * @see javax.servlet.jsp.tagext.Tag#doEndTag() 156 */ 157 public int doEndTag() { 158 return EVAL_PAGE; 159 } 160 161 162 163 /** 164 * @param showUDFs the showUDFs to set 165 */ 166 public void setShowudfs(boolean showUDFs) { 167 this.showUDFs = showUDFs; 168 } 169 170 171 172 /** 173 * @param abort the abort to set 174 */ 175 public void setAbort(boolean abort) { 176 this.abort = abort; 177 } 178 179 }