* 1) Create a RenderInput object and fill it with all the Request information 2) Call the portletContainer.render() method
* of the Portlet Container to get the HTML generated fragment 3) Then if the current request is an AJAX one, just write in
* the buffer the content returned by the portlet container 4) If not AJAX, then merge the content with the UIPortlet.gtmpl
*/
public void processRender(UIPortlet<S, C> uicomponent, WebuiRequestContext context) throws Exception {
PortalRequestContext prcontext = (PortalRequestContext) context;
ExoContainer container = prcontext.getApplication().getApplicationServiceContainer();
//
Text markup = null;
try {
Map<String, String[]> paramMap = prcontext.getRequest().getParameterMap();
if (paramMap.containsKey("removePP")) {
UIPortal uiPortal = Util.getUIPortal();
for (String publicParamName : paramMap.get("removePP")) {
uiPortal.getPublicParameters().remove(publicParamName);
}
}
RenderInvocation renderInvocation = uicomponent.create(RenderInvocation.class, prcontext);
String appStatus = uicomponent.getProperties().get("appStatus");
if ("Window".equals(uicomponent.getPortletStyle()) && !("SHOW".equals(appStatus) || "HIDE".equals(appStatus))) {
markup = Text.create("<span></span>");
} else {
int portalMode = Util.getUIPortalApplication().getModeState();
// Check mode of portal, portlet and permission for viewable
if ((portalMode == UIPortalApplication.NORMAL_MODE || portalMode == UIPortalApplication.APP_VIEW_EDIT_MODE
|| portalMode == UIPortalApplication.CONTAINER_VIEW_EDIT_MODE || uicomponent.getCurrentPortletMode()
.equals(PortletMode.EDIT)) && uicomponent.hasPermission()) {
PortletInvocationResponse response = uicomponent.invoke(renderInvocation);
markup = uicomponent.generateRenderMarkup(response, prcontext);
} else {
uicomponent.setConfiguredTitle(null);
}
}
} catch (Exception e) {
PortletContainerException pcException = new PortletContainerException(e);
PortletExceptionHandleService portletExceptionService = uicomponent
.getApplicationComponent(PortletExceptionHandleService.class);
if (portletExceptionService != null) {
portletExceptionService.handle(pcException);
}
if (e instanceof NoSuchDataException) {
UIPortalApplication uiApp = Util.getUIPortalApplication();
uiApp.refreshCachedUI();
markup = Text.create(context.getApplicationResourceBundle().getString("UIPortlet.message.staleData"));
} else {
// Log the error
log.error("Portlet render threw an exception", pcException);
//
markup = Text.create(context.getApplicationResourceBundle().getString("UIPortlet.message.RuntimeError"));
}
}
//
if (context.useAjax() && !prcontext.getFullRender()) {
if (markup != null) {
markup.writeTo(prcontext.getWriter());
}
} else {
WebuiApplication app = (WebuiApplication) prcontext.getApplication();
ApplicationResourceResolver resolver = app.getResourceResolver();
WebuiBindingContext bcontext = new WebuiBindingContext(resolver, context.getWriter(), uicomponent, prcontext);
bcontext.put(UIComponent.UICOMPONENT, uicomponent);
bcontext.put("portletContent", markup);
try {