01: /*
02: * Copyright 1999,2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.catalina.ssi;
18:
19: import java.io.PrintWriter;
20:
21: /**
22: * Implements the Server-side #exec command
23: *
24: * @author Bip Thelin
25: * @author Dan Sandberg
26: * @version $Revision: 1.3 $, $Date: 2004/02/27 14:58:47 $
27: */
28: public final class SSIConfig implements SSICommand {
29: /**
30: * @see SSICommand
31: */
32: public void process(SSIMediator ssiMediator, String[] paramNames,
33: String[] paramValues, PrintWriter writer) {
34:
35: for (int i = 0; i < paramNames.length; i++) {
36: String paramName = paramNames[i];
37: String paramValue = paramValues[i];
38:
39: if (paramName.equalsIgnoreCase("errmsg")) {
40: ssiMediator.setConfigErrMsg(paramValue);
41: } else if (paramName.equalsIgnoreCase("sizefmt")) {
42: ssiMediator.setConfigSizeFmt(paramValue);
43: } else if (paramName.equalsIgnoreCase("timefmt")) {
44: ssiMediator.setConfigTimeFmt(paramValue);
45: } else {
46: ssiMediator.log("#config--Invalid attribute: "
47: + paramName);
48: //We need to fetch this value each time, since it may change during the loop
49: String configErrMsg = ssiMediator.getConfigErrMsg();
50: writer.write(configErrMsg);
51: }
52: }
53: }
54: }
|