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

Method process

java/org/apache/catalina/ssi/SSIEcho.java:49–79  ·  view source on GitHub ↗

Processes the echo directive to output the value of a server variable.

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

Source from the content-addressed store, hash-verified

47 * Processes the echo directive to output the value of a server variable.
48 */
49 @Override
50 public long process(SSIMediator ssiMediator, String commandName, String[] paramNames, String[] paramValues,
51 PrintWriter writer) {
52 String encoding = DEFAULT_ENCODING;
53 String originalValue = null;
54 String errorMessage = ssiMediator.getConfigErrMsg();
55 for (int i = 0; i < paramNames.length; i++) {
56 String paramName = paramNames[i];
57 String paramValue = paramValues[i];
58 if (paramName.equalsIgnoreCase("var")) {
59 originalValue = paramValue;
60 } else if (paramName.equalsIgnoreCase("encoding")) {
61 if (isValidEncoding(paramValue)) {
62 encoding = paramValue;
63 } else {
64 ssiMediator.log(sm.getString("ssiEcho.invalidEncoding", paramValue));
65 writer.write(ssiMediator.encode(errorMessage, SSIMediator.ENCODING_ENTITY));
66 }
67 } else {
68 ssiMediator.log(sm.getString("ssiCommand.invalidAttribute", paramName));
69 writer.write(ssiMediator.encode(errorMessage, SSIMediator.ENCODING_ENTITY));
70 }
71 }
72 String variableValue = (originalValue == null) ? MISSING_VARIABLE_VALUE :
73 ssiMediator.getVariableValue(originalValue, encoding);
74 if (variableValue == null) {
75 variableValue = MISSING_VARIABLE_VALUE;
76 }
77 writer.write(variableValue);
78 return System.currentTimeMillis();
79 }
80
81
82 /**

Callers

nothing calls this directly

Calls 8

isValidEncodingMethod · 0.95
getConfigErrMsgMethod · 0.80
logMethod · 0.65
getStringMethod · 0.65
writeMethod · 0.65
encodeMethod · 0.65
getVariableValueMethod · 0.65
equalsIgnoreCaseMethod · 0.45

Tested by

no test coverage detected