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

SSIInclude

public final class SSIInclude extends Object implements SSICommand
Implements the Server-side #include command
author
Bip Thelin
author
Paul Speed
author
Dan Sandberg
author
David Becker
version
$Revision: 1.4 $, $Date: 2007/05/05 05:32:20 $

Fields Summary
Constructors Summary
Methods Summary
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 configErrMsg = ssiMediator.getConfigErrMsg();
        for (int i = 0; i < paramNames.length; i++) {
            String paramName = paramNames[i];
            String paramValue = paramValues[i];
            String substitutedValue = ssiMediator
                    .substituteVariables(paramValue);
            try {
                if (paramName.equalsIgnoreCase("file")
                        || paramName.equalsIgnoreCase("virtual")) {
                    boolean virtual = paramName.equalsIgnoreCase("virtual");
                    lastModified = ssiMediator.getFileLastModified(
                    		 substitutedValue, virtual);
                    String text = ssiMediator.getFileText(substitutedValue,
                            virtual);
                    writer.write(text);
                } else {
                    ssiMediator.log("#include--Invalid attribute: "
                            + paramName);
                    writer.write(configErrMsg);
                }
            } catch (IOException e) {
                ssiMediator.log("#include--Couldn't include file: "
                        + substitutedValue, e);
                writer.write(configErrMsg);
            }
        }
        return lastModified;