1 11 package org.apache.catalina.ssi; 12 13 14 import java.io.PrintWriter ; 15 23 public class SSISet implements SSICommand { 24 27 public long process(SSIMediator ssiMediator, String commandName, 28 String [] paramNames, String [] paramValues, PrintWriter writer) 29 throws SSIStopProcessingException { 30 long lastModified = 0; 31 String errorMessage = ssiMediator.getConfigErrMsg(); 32 String variableName = null; 33 for (int i = 0; i < paramNames.length; i++) { 34 String paramName = paramNames[i]; 35 String paramValue = paramValues[i]; 36 if (paramName.equalsIgnoreCase("var")) { 37 variableName = paramValue; 38 } else if (paramName.equalsIgnoreCase("value")) { 39 if (variableName != null) { 40 String substitutedValue = ssiMediator 41 .substituteVariables(paramValue); 42 ssiMediator.setVariableValue(variableName, 43 substitutedValue); 44 lastModified = System.currentTimeMillis(); 45 } else { 46 ssiMediator.log("#set--no variable specified"); 47 writer.write(errorMessage); 48 throw new SSIStopProcessingException(); 49 } 50 } else { 51 ssiMediator.log("#set--Invalid attribute: " + paramName); 52 writer.write(errorMessage); 53 throw new SSIStopProcessingException(); 54 } 55 } 56 return lastModified; 57 } 58 } | Popular Tags |