1 18 19 20 package org.apache.struts.config; 21 22 23 import java.io.Serializable ; 24 25 26 34 35 public class ControllerConfig implements Serializable { 36 37 38 40 41 44 protected boolean configured = false; 45 46 47 49 50 53 protected int bufferSize = 4096; 54 55 public int getBufferSize() { 56 return (this.bufferSize); 57 } 58 59 public void setBufferSize(int bufferSize) { 60 if (configured) { 61 throw new IllegalStateException ("Configuration is frozen"); 62 } 63 this.bufferSize = bufferSize; 64 } 65 66 67 70 protected String contentType = "text/html"; 71 72 public String getContentType() { 73 return (this.contentType); 74 } 75 76 public void setContentType(String contentType) { 77 if (configured) { 78 throw new IllegalStateException ("Configuration is frozen"); 79 } 80 this.contentType = contentType; 81 } 82 83 104 protected String forwardPattern = null; 105 106 public String getForwardPattern() { 107 return (this.forwardPattern); 108 } 109 110 public void setForwardPattern(String forwardPattern) { 111 this.forwardPattern = forwardPattern; 112 } 113 114 115 124 protected boolean inputForward = false; 125 126 public boolean getInputForward() { 127 return (this.inputForward); 128 } 129 130 public void setInputForward(boolean inputForward) { 131 this.inputForward = inputForward; 132 } 133 134 135 138 protected boolean locale = true; 139 140 public boolean getLocale() { 141 return (this.locale); 142 } 143 144 public void setLocale(boolean locale) { 145 if (configured) { 146 throw new IllegalStateException ("Configuration is frozen"); 147 } 148 this.locale = locale; 149 } 150 151 152 155 protected String maxFileSize = "250M"; 156 157 public String getMaxFileSize() { 158 return (this.maxFileSize); 159 } 160 161 public void setMaxFileSize(String maxFileSize) { 162 if (configured) { 163 throw new IllegalStateException ("Configuration is frozen"); 164 } 165 this.maxFileSize = maxFileSize; 166 } 167 168 169 172 protected String memFileSize = "256K"; 173 174 public String getMemFileSize() { 175 return (this.memFileSize); 176 } 177 178 public void setMemFileSize(String memFileSize) { 179 if (configured) { 180 throw new IllegalStateException ("Configuration is frozen"); 181 } 182 this.memFileSize = memFileSize; 183 } 184 185 186 190 protected String multipartClass = 191 "org.apache.struts.upload.CommonsMultipartRequestHandler"; 192 193 public String getMultipartClass() { 194 return (this.multipartClass); 195 } 196 197 public void setMultipartClass(String multipartClass) { 198 if (configured) { 199 throw new IllegalStateException ("Configuration is frozen"); 200 } 201 this.multipartClass = multipartClass; 202 } 203 204 205 208 protected boolean nocache = false; 209 210 public boolean getNocache() { 211 return (this.nocache); 212 } 213 214 public void setNocache(boolean nocache) { 215 if (configured) { 216 throw new IllegalStateException ("Configuration is frozen"); 217 } 218 this.nocache = nocache; 219 } 220 221 222 244 protected String pagePattern = null; 245 246 public String getPagePattern() { 247 return (this.pagePattern); 248 } 249 250 public void setPagePattern(String pagePattern) { 251 this.pagePattern = pagePattern; 252 } 253 254 255 259 protected String processorClass = 260 "org.apache.struts.action.RequestProcessor"; 261 262 public String getProcessorClass() { 263 return (this.processorClass); 264 } 265 266 public void setProcessorClass(String processorClass) { 267 if (configured) { 268 throw new IllegalStateException ("Configuration is frozen"); 269 } 270 this.processorClass = processorClass; 271 } 272 273 274 277 protected String tempDir = null; 278 279 public String getTempDir() { 280 return (this.tempDir); 281 } 282 283 public void setTempDir(String tempDir) { 284 if (configured) { 285 throw new IllegalStateException ("Configuration is frozen"); 286 } 287 this.tempDir = tempDir; 288 } 289 290 291 293 294 297 public void freeze() { 298 299 configured = true; 300 301 } 302 303 304 307 public String toString() { 308 309 StringBuffer sb = new StringBuffer ("ControllerConfig["); 310 sb.append("bufferSize="); 311 sb.append(this.bufferSize); 312 if (this.contentType != null) { 313 sb.append(",contentType="); 314 sb.append(this.contentType); 315 } 316 if (this.forwardPattern != null) { 317 sb.append(",forwardPattern="); 318 sb.append(this.forwardPattern); 319 } 320 sb.append(",inputForward="); 321 sb.append(this.inputForward); 322 sb.append(",locale="); 323 sb.append(this.locale); 324 if (this.maxFileSize != null) { 325 sb.append(",maxFileSize="); 326 sb.append(this.maxFileSize); 327 } 328 if (this.memFileSize != null) { 329 sb.append(",memFileSize="); 330 sb.append(this.memFileSize); 331 } 332 sb.append(",multipartClass="); 333 sb.append(this.multipartClass); 334 sb.append(",nocache="); 335 sb.append(this.nocache); 336 if (this.pagePattern != null) { 337 sb.append(",pagePattern="); 338 sb.append(this.pagePattern); 339 } 340 sb.append(",processorClass="); 341 sb.append(this.processorClass); 342 if (this.tempDir != null) { 343 sb.append(",tempDir="); 344 sb.append(this.tempDir); 345 } 346 sb.append("]"); 347 return (sb.toString()); 348 349 } 350 351 352 } 353 | Popular Tags |