/**
* Add scripts collected by {@link JavaScriptService} as a partial response extension.
*/
protected void addJavaScriptServicePageScripts(FacesContext context) {
ScriptsHolder scriptsHolder = ServiceTracker.getService(JavaScriptService.class).getScriptsHolder(context);
StringBuilder scripts = new StringBuilder();
for (Object script : scriptsHolder.getScripts()) {
scripts.append(ScriptUtils.toScript(script));
scripts.append(";");
}
for (Object script : scriptsHolder.getPageReadyScripts()) {
scripts.append(ScriptUtils.toScript(script));
scripts.append(";");
}
if (scripts.length() > 0) {
scripts.append("RichFaces.javascriptServiceComplete();");