KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > ssi > SSIConfig


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation. Licensed under the
3  * Apache License, Version 2.0 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of the License
5  * at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
6  * law or agreed to in writing, software distributed under the License is
7  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the specific language
9  * governing permissions and limitations under the License.
10  */

11 package org.apache.catalina.ssi;
12
13
14 import java.io.PrintWriter JavaDoc;
15 /**
16  * Implements the Server-side #exec command
17  *
18  * @author Bip Thelin
19  * @author Paul Speed
20  * @author Dan Sandberg
21  * @author David Becker
22  * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
23  */

24 public final class SSIConfig implements SSICommand {
25     /**
26      * @see SSICommand
27      */

28     public long process(SSIMediator ssiMediator, String JavaDoc commandName,
29             String JavaDoc[] paramNames, String JavaDoc[] paramValues, PrintWriter JavaDoc writer) {
30         for (int i = 0; i < paramNames.length; i++) {
31             String JavaDoc paramName = paramNames[i];
32             String JavaDoc paramValue = paramValues[i];
33             String JavaDoc substitutedValue = ssiMediator
34                     .substituteVariables(paramValue);
35             if (paramName.equalsIgnoreCase("errmsg")) {
36                 ssiMediator.setConfigErrMsg(substitutedValue);
37             } else if (paramName.equalsIgnoreCase("sizefmt")) {
38                 ssiMediator.setConfigSizeFmt(substitutedValue);
39             } else if (paramName.equalsIgnoreCase("timefmt")) {
40                 ssiMediator.setConfigTimeFmt(substitutedValue);
41             } else {
42                 ssiMediator.log("#config--Invalid attribute: " + paramName);
43                 //We need to fetch this value each time, since it may change
44
// during the
45
// loop
46
String JavaDoc configErrMsg = ssiMediator.getConfigErrMsg();
47                 writer.write(configErrMsg);
48             }
49         }
50         // Setting config options doesn't really change the page
51
return 0;
52     }
53 }
Popular Tags