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

Method process

java/org/apache/catalina/ssi/SSIFsize.java:51–77  ·  view source on GitHub ↗

Processes the fsize directive to output the size of a file.

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

Source from the content-addressed store, hash-verified

49 * Processes the fsize directive to output the size of a file.
50 */
51 @Override
52 public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues,
53 PrintWriter writer) {
54 long lastModified = 0;
55 String configErrMsg = ssiMediator.getConfigErrMsg();
56 for (int i = 0; i < paramNames.length; i++) {
57 String paramName = paramNames[i];
58 String paramValue = paramValues[i];
59 String substitutedValue = ssiMediator.substituteVariables(paramValue);
60 try {
61 if (paramName.equalsIgnoreCase("file") || paramName.equalsIgnoreCase("virtual")) {
62 boolean virtual = paramName.equalsIgnoreCase("virtual");
63 lastModified = ssiMediator.getFileLastModified(substitutedValue, virtual);
64 long size = ssiMediator.getFileSize(substitutedValue, virtual);
65 String configSizeFmt = ssiMediator.getConfigSizeFmt();
66 writer.write(formatSize(size, configSizeFmt));
67 } else {
68 ssiMediator.log(sm.getString("ssiCommand.invalidAttribute", paramName));
69 writer.write(configErrMsg);
70 }
71 } catch (IOException ioe) {
72 ssiMediator.log(sm.getString("ssiFsize.noSize", substitutedValue), ioe);
73 writer.write(configErrMsg);
74 }
75 }
76 return lastModified;
77 }
78
79
80 /**

Callers

nothing calls this directly

Calls 10

formatSizeMethod · 0.95
getConfigErrMsgMethod · 0.80
substituteVariablesMethod · 0.80
getConfigSizeFmtMethod · 0.80
getFileLastModifiedMethod · 0.65
getFileSizeMethod · 0.65
writeMethod · 0.65
logMethod · 0.65
getStringMethod · 0.65
equalsIgnoreCaseMethod · 0.45

Tested by

no test coverage detected