use of org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker 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
final IPortletDefinitionParameter messageParam = portletDef.getParameter(PortletLifecycleState.CUSTOM_MAINTENANCE_MESSAGE_PARAMETER_NAME);
final Exception mme = messageParam != null && StringUtils.isNotBlank(messageParam.getValue()) ? new MaintenanceModeException(messageParam.getValue()) : new MaintenanceModeException();
portletRenderExecutionWorker = this.portletWorkerFactory.createFailureWorker(request, response, portletWindowId, mme);
} 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;
}
use of org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker in project uPortal by Jasig.
the class PortletExecutionManager method getPortletRenderResult.
/**
* Returns the PortletRenderResult waiting up to the portlet's timeout
*
* @return The PortletRenderResult from the portlet's execution
* @throws TimeoutException If the portlet's timeout was hit before a result was returned
* @throws Exception The exception thrown by the portlet during execution
*/
protected PortletRenderResult getPortletRenderResult(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) throws Exception {
final IPortletRenderExecutionWorker tracker = getRenderedPortletBodyWorker(portletWindowId, request, response);
final long timeout = getPortletRenderTimeout(portletWindowId, request);
return tracker.get(timeout);
}
use of org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker in project uPortal by Jasig.
the class PortletExecutionManager method startPortletHeaderRenderInternal.
/**
* create and submit the portlet header rendering job to the thread pool
*
* @param portletWindowId
* @param request
* @param response
* @return
*/
protected IPortletRenderExecutionWorker startPortletHeaderRenderInternal(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) {
IPortletRenderExecutionWorker portletHeaderRenderWorker = this.portletWorkerFactory.createRenderHeaderWorker(request, response, portletWindowId);
portletHeaderRenderWorker.submit();
final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletHeaderRenderingMap = this.getPortletHeaderRenderingMap(request);
portletHeaderRenderingMap.put(portletWindowId, portletHeaderRenderWorker);
return portletHeaderRenderWorker;
}
use of org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker in project uPortal by Jasig.
the class PortletExecutionManager method getRenderedPortletHeaderWorker.
protected IPortletRenderExecutionWorker getRenderedPortletHeaderWorker(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) {
final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletHeaderRenderingMap = this.getPortletHeaderRenderingMap(request);
IPortletRenderExecutionWorker portletHeaderRenderWorker = portletHeaderRenderingMap.get(portletWindowId);
if (portletHeaderRenderWorker == null) {
portletHeaderRenderWorker = this.startPortletHeaderRenderInternal(portletWindowId, request, response);
}
return portletHeaderRenderWorker;
}
use of org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker in project uPortal by Jasig.
the class PortletExecutionManager method isPortletRenderRequested.
/* (non-Javadoc)
* @see org.apereo.portal.portlet.rendering.IPortletExecutionManager#isPortletRenderRequested(org.apereo.portal.portlet.om.IPortletWindowId, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public boolean isPortletRenderRequested(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) {
final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletRenderingMap = this.getPortletRenderingMap(request);
final IPortletRenderExecutionWorker tracker = portletRenderingMap.get(portletWindowId);
return tracker != null;
}
Aggregations