2
* $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java,v 1.19 2004/03/14 06:23:47 sraeburn Exp $
4
* $Date: 2004/03/14 06:23:47 $
6
* Copyright 1999-2004 The Apache Software Foundation.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
22
package org.apache.struts.config;
25
import java.io.Serializable;
29
* <p>A JavaBean representing the configuration information of a
30
* <code><controller></code> element in a Struts
31
* configuration file.</p>
33
* @version $Revision: 1.19 $ $Date: 2004/03/14 06:23:47 $
37
public class ControllerConfig implements Serializable {
40
// ----------------------------------------------------- Instance Variables
44
* Has this component been completely configured?
46
protected boolean configured = false;
49
// ------------------------------------------------------------- Properties
53
* The input buffer size for file uploads.
55
protected int bufferSize = 4096;
57
public int getBufferSize() {
58
return (this.bufferSize);
61
public void setBufferSize(int bufferSize) {
63
throw new IllegalStateException("Configuration is frozen");
65
this.bufferSize = bufferSize;
70
* The content type and character encoding to be set on each response.
72
protected String contentType = "text/html";
74
public String getContentType() {
75
return (this.contentType);
78
public void setContentType(String contentType) {
80
throw new IllegalStateException("Configuration is frozen");
82
this.contentType = contentType;
86
* <p>The replacement pattern used to determine a context-relative URL
87
* from a {@link ForwardConfig} element. The pattern may consist of any
88
* combination of the following markers and characters:</p>
90
* <li><code><strong>$M</strong></code> - Replaced by the module
91
* prefix for the current module.</li>
92
* <li><code><strong>$P</strong></code> - Replaced by the <code>path</code>
93
* property of a {@link ForwardConfig} instance.</li>
94
* <li><code><strong>$$</strong></code> - Renders a literal dollar sign
95
* ("$") character in the resulting URL.</li>
96
* <li>A dollar sign followed by any other character is reserved for
97
* future use, and both characters are silently swallowed.</li>
98
* <li>All other characters in the pattern are passed through unchanged.
102
* <p>If this property is set to <code>null</code>, a default pattern of
103
* <code>$M$P</code> is utilized, which is backwards compatible with
104
* the hard coded functionality in prior versions.</p>
106
protected String forwardPattern = null;
108
public String getForwardPattern() {
109
return (this.forwardPattern);
112
public void setForwardPattern(String forwardPattern) {
113
this.forwardPattern = forwardPattern;
118
* <p>Should the <code>input</code> property of {@link ActionConfig}
119
* instances associated with this module be treated as the
120
* name of a corresponding {@link ForwardConfig}. A <code>false</code>
121
* value treats them as a module-relative path (consistent
122
* with the hard coded behavior of earlier versions of Struts.</p>
126
protected boolean inputForward = false;
128
public boolean getInputForward() {
129
return (this.inputForward);
132
public void setInputForward(boolean inputForward) {
133
this.inputForward = inputForward;
138
* Should we store a Locale object in the user's session if needed?
140
protected boolean locale = true;
142
public boolean getLocale() {
143
return (this.locale);
146
public void setLocale(boolean locale) {
148
throw new IllegalStateException("Configuration is frozen");
150
this.locale = locale;
155
* The maximum file size to process for file uploads.
157
protected String maxFileSize = "250M";
159
public String getMaxFileSize() {
160
return (this.maxFileSize);
163
public void setMaxFileSize(String maxFileSize) {
165
throw new IllegalStateException("Configuration is frozen");
167
this.maxFileSize = maxFileSize;
172
* The maximum file size to retain in memory.
174
protected String memFileSize = "256K";
176
public String getMemFileSize() {
177
return (this.memFileSize);
180
public void setMemFileSize(String memFileSize) {
182
throw new IllegalStateException("Configuration is frozen");
184
this.memFileSize = memFileSize;
189
* The fully qualified Java class name of the MultipartRequestHandler
192
protected String multipartClass =
193
"org.apache.struts.upload.CommonsMultipartRequestHandler";
195
public String getMultipartClass() {
196
return (this.multipartClass);
199
public void setMultipartClass(String multipartClass) {
201
throw new IllegalStateException("Configuration is frozen");
203
this.multipartClass = multipartClass;
208
* Should we set no-cache HTTP headers on each response?
210
protected boolean nocache = false;
212
public boolean getNocache() {
213
return (this.nocache);
216
public void setNocache(boolean nocache) {
218
throw new IllegalStateException("Configuration is frozen");
220
this.nocache = nocache;
225
* <p>The replacement pattern used to determine a context-relative URL
226
* from the <code>page</code> attribute of Struts tags and configuration
227
* properties. The pattern may consist of any combination of the
228
* following markers and characters:</p>
230
* <li><code><strong>$M</strong></code> - Replaced by the module
231
* prefix for the current module.</li>
232
* <li><code><strong>$P</strong></code> - Replaced by the <code>page</code>
233
* attribute value being evaluated.</li>
234
* <li><code><strong>$$</strong></code> - Renders a literal dollar sign
235
* ("$") character in the resulting URL.</li>
236
* <li>A dollar sign followed by any other character is reserved for
237
* future use, and both characters are silently swallowed.</li>
238
* <li>All other characters in the pattern are passed through unchanged.
242
* <p>If this property is set to <code>null</code>, a default pattern of
243
* <code>$M$P</code> is utilized, which is backwards compatible with
244
* the hard coded functionality in prior versions.</p>
246
protected String pagePattern = null;
248
public String getPagePattern() {
249
return (this.pagePattern);
252
public void setPagePattern(String pagePattern) {
253
this.pagePattern = pagePattern;
258
* The fully qualified class name of the RequestProcessor implementation
259
* class to be used for this module.
261
protected String processorClass =
262
"org.apache.struts.action.RequestProcessor";
264
public String getProcessorClass() {
265
return (this.processorClass);
268
public void setProcessorClass(String processorClass) {
270
throw new IllegalStateException("Configuration is frozen");
272
this.processorClass = processorClass;
277
* The temporary working directory to use for file uploads.
279
protected String tempDir = null;
281
public String getTempDir() {
282
return (this.tempDir);
285
public void setTempDir(String tempDir) {
287
throw new IllegalStateException("Configuration is frozen");
289
this.tempDir = tempDir;
293
// --------------------------------------------------------- Public Methods
297
* Freeze the configuration of this component.
299
public void freeze() {
307
* Return a String representation of this object.
309
public String toString() {
311
StringBuffer sb = new StringBuffer("ControllerConfig[");
312
sb.append("bufferSize=");
313
sb.append(this.bufferSize);
314
if (this.contentType != null) {
315
sb.append(",contentType=");
316
sb.append(this.contentType);
318
if (this.forwardPattern != null) {
319
sb.append(",forwardPattern=");
320
sb.append(this.forwardPattern);
322
sb.append(",inputForward=");
323
sb.append(this.inputForward);
324
sb.append(",locale=");
325
sb.append(this.locale);
326
if (this.maxFileSize != null) {
327
sb.append(",maxFileSize=");
328
sb.append(this.maxFileSize);
330
if (this.memFileSize != null) {
331
sb.append(",memFileSize=");
332
sb.append(this.memFileSize);
334
sb.append(",multipartClass=");
335
sb.append(this.multipartClass);
336
sb.append(",nocache=");
337
sb.append(this.nocache);
338
if (this.pagePattern != null) {
339
sb.append(",pagePattern=");
340
sb.append(this.pagePattern);
342
sb.append(",processorClass=");
343
sb.append(this.processorClass);
344
if (this.tempDir != null) {
345
sb.append(",tempDir=");
346
sb.append(this.tempDir);
349
return (sb.toString());