in src/main/java/org/apache/sling/scripting/core/impl/ScriptCacheConsolePlugin.java [73:110]
protected void renderContent(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws ServletException, IOException {
if (scriptCache instanceof ScriptCacheImpl) {
ScriptCacheImpl scriptCacheImpl = (ScriptCacheImpl) scriptCache;
List<String> scripts = scriptCacheImpl.getCachedScripts();
StringBuilder sb = new StringBuilder();
sb.append("<script type='text/javascript' src='")
.append(RESOURCES)
.append("/")
.append(SCRIPTCACHE_JS)
.append("'></script>");
sb.append("<div id='cached-scripts' class='ui-widget statline'>");
if (!scripts.isEmpty()) {
Collections.sort(scripts);
sb.append("<p class='ui-widget-header'>Cached Scripts</p>");
sb.append("<table class='nicetable ui-widget-content'>");
int i = 0;
for (String script : scripts) {
sb.append("<tr class='")
.append(i % 2 == 0 ? "even" : "odd")
.append(" ui-state-default'><td>")
.append(++i)
.append("<td><code>")
.append(script)
.append("</code></td><td><button type='button' " + "data-script='")
.append(script)
.append("'>Remove</button></td></tr>");
}
sb.append("<tr><td colspan='3'><button type='button' id='clearcache'>Clear Cache</button></td></tr>");
sb.append("</table>");
} else {
sb.append("<p class='ui-state-highlight'>The Script Cache doesn't contain any scripts.</p>");
}
sb.append("</div>");
httpServletResponse.getWriter().write(sb.toString());
}
}