1 16 17 package org.apache.webapp.admin.valve; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import org.apache.struts.action.ActionError; 21 import org.apache.struts.action.ActionErrors; 22 import org.apache.struts.action.ActionForm; 23 import org.apache.struts.action.ActionMapping; 24 import java.util.List ; 25 26 32 33 public final class AccessLogValveForm extends ValveForm { 34 35 39 private String debugLvl = "0"; 40 41 44 private List debugLvlVals = null; 45 46 49 private String directory = null; 50 51 54 private String pattern = null; 55 56 59 private String prefix = null; 60 61 64 private String suffix = null; 65 66 69 private String resolveHosts = "false"; 70 71 74 private String rotatable = "true"; 75 76 79 private List booleanVals = null; 80 81 83 86 public List getDebugLvlVals() { 87 88 return this.debugLvlVals; 89 90 } 91 92 95 public void setDebugLvlVals(List debugLvlVals) { 96 97 this.debugLvlVals = debugLvlVals; 98 99 } 100 101 104 public List getBooleanVals() { 105 106 return this.booleanVals; 107 108 } 109 110 113 public void setBooleanVals(List booleanVals) { 114 115 this.booleanVals = booleanVals; 116 117 } 118 119 122 public String getDebugLvl() { 123 124 return this.debugLvl; 125 126 } 127 128 131 public void setDebugLvl(String debugLvl) { 132 133 this.debugLvl = debugLvl; 134 135 } 136 137 140 public String getDirectory() { 141 142 return this.directory; 143 144 } 145 146 149 public void setDirectory(String directory) { 150 151 this.directory = directory; 152 153 } 154 155 158 public String getPattern() { 159 160 return this.pattern; 161 162 } 163 164 167 public void setPattern(String pattern) { 168 169 this.pattern = pattern; 170 171 } 172 173 176 public String getPrefix() { 177 178 return this.prefix; 179 180 } 181 182 185 public void setPrefix(String prefix) { 186 187 this.prefix = prefix; 188 189 } 190 191 194 public String getSuffix() { 195 196 return this.suffix; 197 198 } 199 200 203 public void setSuffix(String suffix) { 204 205 this.suffix = suffix; 206 207 } 208 209 212 public String getResolveHosts() { 213 214 return this.resolveHosts; 215 216 } 217 218 221 public void setResolveHosts(String resolveHosts) { 222 223 this.resolveHosts = resolveHosts; 224 225 } 226 227 230 public String getRotatable() { 231 232 return this.rotatable; 233 234 } 235 236 239 public void setRotatable(String rotatable) { 240 241 this.rotatable = rotatable; 242 243 } 244 245 247 253 public void reset(ActionMapping mapping, HttpServletRequest request) { 254 255 super.reset(mapping, request); 256 this.debugLvl = "0"; 257 258 this.directory = null; 259 this.prefix = null; 260 this.suffix = null; 261 this.pattern = null; 262 this.resolveHosts = "false"; 263 this.rotatable = "true"; 264 265 } 266 267 270 public String toString() { 271 272 StringBuffer sb = new StringBuffer ("AccessLogValveForm[adminAction="); 273 sb.append(getAdminAction()); 274 sb.append("',valveType="); 275 sb.append(getValveType()); 276 sb.append(",debugLvl="); 277 sb.append(debugLvl); 278 sb.append(",directory="); 279 sb.append(directory); 280 sb.append("',prefix='"); 281 sb.append(prefix); 282 sb.append("',pattern="); 283 sb.append(pattern); 284 sb.append(",resolveHosts="); 285 sb.append(resolveHosts); 286 sb.append(",rotatable="); 287 sb.append(rotatable); 288 sb.append("',objectName='"); 289 sb.append(getObjectName()); 290 sb.append("]"); 291 return (sb.toString()); 292 293 } 294 295 305 306 public ActionErrors validate(ActionMapping mapping, 307 HttpServletRequest request) { 308 309 ActionErrors errors = new ActionErrors(); 310 311 String submit = request.getParameter("submit"); 312 313 316 if ((prefix == null) || (prefix.length() == 0)){ 319 prefix = "access_log."; 320 } 321 322 if ((suffix == null) || (suffix.length() < 1)) { 324 suffix = ""; 325 } 326 327 if ((directory == null) || (directory.length() < 1)) { 330 directory = "logs"; 331 } 332 333 if ((pattern == null) || (pattern.length() < 1)) { 334 errors.add("pattern", 335 new ActionError("error.pattern.required")); 336 } 337 339 return errors; 340 } 341 } 342 | Popular Tags |