SSIFlastmodpublic final class SSIFlastmod extends Object implements SSICommandImplements the Server-side #flastmod command |
Methods Summary |
---|
protected java.lang.String | formatDate(java.util.Date date, java.lang.String configTimeFmt)
Strftime strftime = new Strftime(configTimeFmt, DateTool.LOCALE_US);
return strftime.format(date);
| public long | process(SSIMediator ssiMediator, java.lang.String commandName, java.lang.String[] paramNames, java.lang.String[] paramValues, java.io.PrintWriter writer)
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;
|
|