Search in sources :

Example 1 with IPortletFailureExecutionWorker

use of org.apereo.portal.portlet.rendering.worker.IPortletFailureExecutionWorker in project uPortal by Jasig.

the class PortletExecutionManager method getPortletOutput.

/* (non-Javadoc)
     * @see org.apereo.portal.portlet.rendering.IPortletExecutionManager#getPortletOutput(org.apereo.portal.portlet.om.IPortletWindowId, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
@Override
public String getPortletOutput(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) {
    final IPortletRenderExecutionWorker tracker = getRenderedPortletBodyWorker(portletWindowId, request, response);
    final long timeout = getPortletRenderTimeout(portletWindowId, request);
    try {
        final String output = tracker.getOutput(timeout);
        return output == null ? "" : output;
    } catch (Exception e) {
        final IPortletFailureExecutionWorker failureWorker = this.portletWorkerFactory.createFailureWorker(request, response, portletWindowId, e);
        // TODO publish portlet error event?
        try {
            failureWorker.submit();
            return failureWorker.getOutput(timeout);
        } catch (Exception e1) {
            logger.error("Failed to render error portlet for: " + portletWindowId, e1);
            return "Error Portlet Unavailable. Please contact your portal administrators.";
        }
    }
}
Also used : IPortletFailureExecutionWorker(org.apereo.portal.portlet.rendering.worker.IPortletFailureExecutionWorker) IPortletRenderExecutionWorker(org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker) IOException(java.io.IOException) MaintenanceModeException(org.apereo.portal.portlets.error.MaintenanceModeException)

Aggregations

IOException (java.io.IOException)1 IPortletFailureExecutionWorker (org.apereo.portal.portlet.rendering.worker.IPortletFailureExecutionWorker)1 IPortletRenderExecutionWorker (org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker)1 MaintenanceModeException (org.apereo.portal.portlets.error.MaintenanceModeException)1