in wilma-extras/shortCircuit/src/main/java/com/epam/wilma/extras/shortcircuit/ShortCircuitInterceptorCore.java [213:242]
private String getShortCircuitMap(HttpServletResponse httpServletResponse) {
StringBuilder response = new StringBuilder("{\n \"shortCircuitCache\": [\n");
if (!shortCircuitMap.isEmpty()) {
String[] keySet = shortCircuitMap.keySet().toArray(new String[shortCircuitMap.size()]);
for (int i = 0; i < keySet.length; i++) {
String entryKey = keySet[i];
ShortCircuitResponseInformation shortCircuitResponseInformation = shortCircuitMap.get(entryKey);
boolean cached = shortCircuitResponseInformation != null;
long usageCount = 0;
if (shortCircuitResponseInformation != null) {
usageCount = shortCircuitResponseInformation.getUsageCount();
}
//CHECKSTYLE OFF - we must use "new String" here
String decodedEntryKey = new String(Base64.decodeBase64(entryKey)); //make it human readable
//CHECKSTYLE ON
response.append(" { \"id\": \"").append(i)
.append("\", \"hashCode\": \"").append(decodedEntryKey)
.append("\", \"cached\": ").append(cached)
.append(", \"usageCount\": ").append(usageCount)
.append(" }");
if (i < keySet.length - 1) {
response.append(",");
}
response.append("\n");
}
}
response.append(" ]\n}\n");
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
return response.toString();
}