public String getEditModeContent() { StringBuilder portletContent = new StringBuilder(); try { PortalRequestContext prcontext = (PortalRequestContext) WebuiRequestContext.getCurrentInstance(); prcontext.ignoreAJAXUpdateOnPortlets(true); StatefulPortletContext portletContext = uiPortlet_.getPortletContext(); ExoPortletInvocationContext portletInvocationContext = new ExoPortletInvocationContext(prcontext, uiPortlet_); List<Cookie> requestCookies = new ArrayList<Cookie>(Arrays.asList(prcontext.getRequest().getCookies())); PortletInvocation portletInvocation = uiPortlet_.create(RenderInvocation.class, prcontext); RenderInvocation renderInvocation = (RenderInvocation) portletInvocation; // make sure we are in the EDIT mode, and not whatever the current portlet mode is for the // Portlet renderInvocation.setMode(Mode.create(PortletMode.EDIT.toString())); PortletInvocationResponse portletResponse = uiPortlet_.invoke(renderInvocation); portletContent.append(uiPortlet_.generateRenderMarkup(portletResponse, prcontext).toString()); } catch (Throwable ex) { WebuiRequestContext webuiRequest = WebuiRequestContext.getCurrentInstance(); portletContent.append( webuiRequest.getApplicationResourceBundle().getString("UIPortlet.message.RuntimeError")); log.error( "The portlet " + uiPortlet_.getName() + " could not be loaded. Check if properly deployed.", ExceptionUtil.getRootCause(ex)); } return portletContent.toString(); }