MCPcopy Create free account
hub / github.com/apache/tomcat / process

Method process

java/org/apache/catalina/ssi/SSIFlastmod.java:42–68  ·  view source on GitHub ↗

Processes the flastmod directive to output the last modified date of a file.

(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues,
            PrintWriter writer)

Source from the content-addressed store, hash-verified

40 * Processes the flastmod directive to output the last modified date of a file.
41 */
42 @Override
43 public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues,
44 PrintWriter writer) {
45 long lastModified = 0;
46 String configErrMsg = ssiMediator.getConfigErrMsg();
47 for (int i = 0; i < paramNames.length; i++) {
48 String paramName = paramNames[i];
49 String paramValue = paramValues[i];
50 String substitutedValue = ssiMediator.substituteVariables(paramValue);
51 try {
52 if (paramName.equalsIgnoreCase("file") || paramName.equalsIgnoreCase("virtual")) {
53 boolean virtual = paramName.equalsIgnoreCase("virtual");
54 lastModified = ssiMediator.getFileLastModified(substitutedValue, virtual);
55 Date date = new Date(lastModified);
56 String configTimeFmt = ssiMediator.getConfigTimeFmt();
57 writer.write(formatDate(date, configTimeFmt));
58 } else {
59 ssiMediator.log(sm.getString("ssiCommand.invalidAttribute", paramName));
60 writer.write(configErrMsg);
61 }
62 } catch (IOException ioe) {
63 ssiMediator.log(sm.getString("ssiFlastmod.noLastModified", substitutedValue), ioe);
64 writer.write(configErrMsg);
65 }
66 }
67 return lastModified;
68 }
69
70
71 private String formatDate(Date date, String configTimeFmt) {

Callers

nothing calls this directly

Calls 9

formatDateMethod · 0.95
getConfigErrMsgMethod · 0.80
substituteVariablesMethod · 0.80
getConfigTimeFmtMethod · 0.80
getFileLastModifiedMethod · 0.65
writeMethod · 0.65
logMethod · 0.65
getStringMethod · 0.65
equalsIgnoreCaseMethod · 0.45

Tested by

no test coverage detected