// Flush all input that has been written to the response so far.
pageContext.getOut().flush();
// Render the pagelet
Renderer renderer = null;
Pagelet pagelet = pagePreview.getPagelets()[index];
try {
request.setAttribute(WebloungeRequest.PAGE, page);
request.setAttribute(WebloungeRequest.PAGELET, pagelet);
request.setAttribute(WebloungeRequest.COMPOSER, pagePreview);
pageContext.setAttribute(PagePreviewTagVariables.PAGELET, pagelet);
if (render) {
String moduleId = pagelet.getModule();
String rendererId = pagelet.getIdentifier();
// Check access rights
// TODO: Check access
// Permission p = SystemPermission.READ;
// if (!pagelet.checkOne(p, user.getRoleClosure()) &&
// !pagelet.check(p, user)) {
// logger.debug("Skipping pagelet " + i + " in composer " + composer_
// +
// " due to insufficient rights");
// continue p;
// }
// Check publishing dates
// TODO: Fix this. pagelet.isPublished() currently returns false,
// as both from and to dates are null (see PublishingCtx)
// if (!(request.getVersion() == Resource.WORK) &&
// !pagelet.isPublished()) {
// logger.debug("Skipping pagelet " + index + " in composer " + stage
// + " since it is not yet published");
// return false;
// }
// Select the renderer's module
Module m = site.getModule(moduleId);
if (m == null) {
logger.warn("Unable to load renderer '" + rendererId + "' for " + pageUrl + ": module '" + moduleId + "' not found!");
return false;
}
// Load renderer
renderer = m.getRenderer(rendererId);
if (renderer == null) {
logger.warn("No suitable renderer '" + moduleId + "/" + rendererId + "' found to render on " + pageUrl);
return false;
}
// Render pagelet
try {
renderer.render(request, response);
writer.flush();
} catch (Throwable e) {
// String params = RequestSupport.getParameters(request);
String msg = "Error rendering " + renderer + " on " + pageUrl + "'";
String reason = "";