Search in sources :

Example 1 with MaintenanceModeException

use of org.apereo.portal.portlets.error.MaintenanceModeException in project uPortal by Jasig.

the class PortletExecutionManager method startPortletRenderInternal.

/** create and submit the portlet content rendering job to the thread pool */
protected IPortletRenderExecutionWorker startPortletRenderInternal(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) {
    // first check to see if there is a Throwable in the session for this IPortletWindowId
    final Map<IPortletWindowId, Exception> portletFailureMap = getPortletErrorMap(request);
    final Exception cause = portletFailureMap.remove(portletWindowId);
    final IPortletRenderExecutionWorker portletRenderExecutionWorker;
    if (null != cause) {
        // previous action failed, dispatch to errorPortlet immediately
        portletRenderExecutionWorker = this.portletWorkerFactory.createFailureWorker(request, response, portletWindowId, cause);
    } else {
        IPortletWindow portletWindow = portletWindowRegistry.getPortletWindow(request, portletWindowId);
        IPortletDefinition portletDef = portletWindow.getPortletEntity().getPortletDefinition();
        if (portletDef.getLifecycleState().equals(PortletLifecycleState.MAINTENANCE)) {
            // Prevent the portlet from rendering;  replace with a helpful "Out of Service" message
            portletRenderExecutionWorker = this.portletWorkerFactory.createFailureWorker(request, response, portletWindowId, new MaintenanceModeException());
        } else {
            // Happy path
            portletRenderExecutionWorker = this.portletWorkerFactory.createRenderWorker(request, response, portletWindowId);
        }
    }
    portletRenderExecutionWorker.submit();
    final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletRenderingMap = this.getPortletRenderingMap(request);
    portletRenderingMap.put(portletWindowId, portletRenderExecutionWorker);
    return portletRenderExecutionWorker;
}
Also used : MaintenanceModeException(org.apereo.portal.portlets.error.MaintenanceModeException) IPortletRenderExecutionWorker(org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IOException(java.io.IOException) MaintenanceModeException(org.apereo.portal.portlets.error.MaintenanceModeException) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Aggregations

IOException (java.io.IOException)1 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)1 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)1 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)1 IPortletRenderExecutionWorker (org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker)1 MaintenanceModeException (org.apereo.portal.portlets.error.MaintenanceModeException)1