FileDocCategorySizeDatePackage
SSIEcho.javaAPI DocGlassfish v2 API4080Fri May 04 22:32:20 BST 2007org.apache.catalina.ssi

SSIEcho

public class SSIEcho extends Object implements SSICommand
Return the result associated with the supplied Server Variable.
author
Bip Thelin
author
Paul Speed
author
Dan Sandberg
author
David Becker
version
$Revision: 1.4 $, $Date: 2007/05/05 05:32:19 $

Fields Summary
protected static final String
DEFAULT_ENCODING
protected static final String
MISSING_VARIABLE_VALUE
Constructors Summary
Methods Summary
protected booleanisValidEncoding(java.lang.String encoding)

        return encoding.equalsIgnoreCase("url")
                || encoding.equalsIgnoreCase("entity")
                || encoding.equalsIgnoreCase("none");
    
public longprocess(SSIMediator ssiMediator, java.lang.String commandName, java.lang.String[] paramNames, java.lang.String[] paramValues, java.io.PrintWriter writer)

see
SSICommand



           
         
                  
    	long lastModified = 0;
        String encoding = DEFAULT_ENCODING;
        String errorMessage = ssiMediator.getConfigErrMsg();
        for (int i = 0; i < paramNames.length; i++) {
            String paramName = paramNames[i];
            String paramValue = paramValues[i];
            if (paramName.equalsIgnoreCase("var")) {
                String variableValue = ssiMediator.getVariableValue(
                        paramValue, encoding);
                if (variableValue == null) {
                    variableValue = MISSING_VARIABLE_VALUE;
                }
                writer.write(variableValue);
                lastModified = System.currentTimeMillis();
            } else if (paramName.equalsIgnoreCase("encoding")) {
                if (isValidEncoding(paramValue)) {
                    encoding = paramValue;
                } else {
                    ssiMediator.log("#echo--Invalid encoding: " + paramValue);
                    writer.write(errorMessage);
                }
            } else {
                ssiMediator.log("#echo--Invalid attribute: " + paramName);
                writer.write(errorMessage);
            }
        }
        return lastModified;