FileDocCategorySizeDatePackage
SSIFlastmod.javaAPI DocApache Tomcat 6.0.143136Fri Jul 20 04:20:36 BST 2007org.apache.catalina.ssi

SSIFlastmod

public final class SSIFlastmod extends Object implements SSICommand
Implements the Server-side #flastmod command
author
Bip Thelin
author
Paul Speed
author
Dan Sandberg
author
David Becker
version
$Revision: 531303 $, $Date: 2007-04-23 02:24:01 +0200 (lun., 23 avr. 2007) $

Fields Summary
Constructors Summary
Methods Summary
protected java.lang.StringformatDate(java.util.Date date, java.lang.String configTimeFmt)

        Strftime strftime = new Strftime(configTimeFmt, DateTool.LOCALE_US);
        return strftime.format(date);
    
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);
                    Date date = new Date(lastModified);
                    String configTimeFmt = ssiMediator.getConfigTimeFmt();
                    writer.write(formatDate(date, configTimeFmt));
                } else {
                    ssiMediator.log("#flastmod--Invalid attribute: "
                            + paramName);
                    writer.write(configErrMsg);
                }
            } catch (IOException e) {
                ssiMediator.log(
                        "#flastmod--Couldn't get last modified for file: "
                                + substitutedValue, e);
                writer.write(configErrMsg);
            }
        }
        return lastModified;