Search in sources :

Example 76 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletEventCoordinatationService method processEvents.

@Override
public void processEvents(PortletContainer container, PortletWindow plutoPortletWindow, HttpServletRequest request, HttpServletResponse response, List<Event> events) {
    final PortletEventQueue requestPortletEventQueue = this.getPortletEventQueue(request);
    this.logger.debug("Queued {} from {}", events, plutoPortletWindow);
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(request, plutoPortletWindow);
    final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
    // Add list transformer to convert Event to QueuedEvent
    final List<QueuedEvent> queuedEvents = Lists.transform(events, new Function<Event, QueuedEvent>() {

        /* (non-Javadoc)
                             * @see com.google.common.base.Function#apply(java.lang.Object)
                             */
        @Override
        public QueuedEvent apply(Event event) {
            return new QueuedEvent(portletWindowId, event);
        }
    });
    requestPortletEventQueue.addEvents(queuedEvents);
}
Also used : Event(javax.portlet.Event) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 77 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletExecutionManager method cancelWorker.

/**
 * Cancel the worker and add it to the hung workers queue
 */
protected void cancelWorker(HttpServletRequest request, IPortletExecutionWorker<?> portletExecutionWorker) {
    final IPortletWindowId portletWindowId = portletExecutionWorker.getPortletWindowId();
    final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
    this.logger.warn("{} has not completed, adding to hung-worker cleanup queue: {}", portletExecutionWorker, portletWindow);
    portletExecutionWorker.cancel();
    this.portletExecutionEventFactory.publishPortletHungEvent(request, this, portletExecutionWorker);
    hungWorkers.offer(portletExecutionWorker);
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 78 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletExecutionManager method getPortletErrorMap.

/**
 * Null safe means for retrieving the {@link Map} from the specified session keyed by {@link
 * #SESSION_ATTRIBUTE__PORTLET_FAILURE_CAUSE_MAP}.
 *
 * @param request HttpServletRequest
 * @return a never null {@link Map} in the session for storing portlet failure causes.
 */
@SuppressWarnings("unchecked")
protected Map<IPortletWindowId, Exception> getPortletErrorMap(HttpServletRequest request) {
    final HttpSession session = request.getSession();
    synchronized (WebUtils.getSessionMutex(session)) {
        Map<IPortletWindowId, Exception> portletFailureMap = (Map<IPortletWindowId, Exception>) session.getAttribute(SESSION_ATTRIBUTE__PORTLET_FAILURE_CAUSE_MAP);
        if (portletFailureMap == null) {
            portletFailureMap = new ConcurrentHashMap<IPortletWindowId, Exception>();
            session.setAttribute(SESSION_ATTRIBUTE__PORTLET_FAILURE_CAUSE_MAP, portletFailureMap);
        }
        return portletFailureMap;
    }
}
Also used : HttpSession(javax.servlet.http.HttpSession) ConcurrentMap(java.util.concurrent.ConcurrentMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TreeMap(java.util.TreeMap) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IOException(java.io.IOException) MaintenanceModeException(org.apereo.portal.portlets.error.MaintenanceModeException)

Example 79 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletExecutionManager method checkWorkerCompletion.

/**
 * Checks to see if a worker has been retrieved (not orphaned) and if it is complete.
 */
protected void checkWorkerCompletion(HttpServletRequest request, IPortletRenderExecutionWorker portletRenderExecutionWorker) {
    if (!portletRenderExecutionWorker.isRetrieved()) {
        final IPortletWindowId portletWindowId = portletRenderExecutionWorker.getPortletWindowId();
        final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        this.logger.warn("Portlet worker started but never retrieved for {}, worker {}." + " If random portlet fnames it may be users switching tabs before page is done rendering" + " (would see separate log message with java.net.SocketException on socket write)." + " If repeatedly occurring with one portlet fname your theme layout xsl may not be including" + " a portlet present in your layout xml files (see" + " http://jasig.275507.n4.nabble.com/Portlet-worker-started-but-never-retrieved-td4580698.html)", portletWindow, portletRenderExecutionWorker);
        try {
            portletRenderExecutionWorker.get(0);
        } catch (Exception e) {
        // Ignore exception here, we just want to get this worker to complete
        }
    }
    if (!portletRenderExecutionWorker.isComplete()) {
        cancelWorker(request, portletRenderExecutionWorker);
    }
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IOException(java.io.IOException) MaintenanceModeException(org.apereo.portal.portlets.error.MaintenanceModeException)

Example 80 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletErrorController method executeReset.

/**
 * @param request
 * @param response
 * @throws Exception
 */
@RequestMapping("VIEW")
public void executeReset(ActionRequest request, ActionResponse response) throws Exception {
    final String windowId = request.getParameter("failedPortletWindowId");
    if (StringUtils.isNotBlank(windowId)) {
        HttpServletRequest httpRequest = this.portalRequestUtils.getPortletHttpRequest(request);
        IPortletWindowId portletWindowId = this.portletWindowRegistry.getPortletWindowId(httpRequest, windowId);
        HttpServletResponse httpResponse = this.portalRequestUtils.getOriginalPortalResponse(request);
        this.portletRenderer.doReset(portletWindowId, httpRequest, httpResponse);
        IPortalUrlBuilder builder = this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(httpRequest, portletWindowId, UrlType.RENDER);
        response.sendRedirect(builder.getUrlString());
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpServletResponse(javax.servlet.http.HttpServletResponse) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)85 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)31 Test (org.junit.Test)19 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)19 MockPortletWindowId (org.apereo.portal.mock.portlet.om.MockPortletWindowId)15 WindowState (javax.portlet.WindowState)10 HttpServletRequest (javax.servlet.http.HttpServletRequest)9 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)9 PortletMode (javax.portlet.PortletMode)8 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)8 IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)8 IPortletRenderExecutionWorker (org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker)7 IPerson (org.apereo.portal.security.IPerson)7 IPortletUrlBuilder (org.apereo.portal.url.IPortletUrlBuilder)7 LinkedHashMap (java.util.LinkedHashMap)6 IPortalUrlBuilder (org.apereo.portal.url.IPortalUrlBuilder)6 IUserInstance (org.apereo.portal.user.IUserInstance)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 IOException (java.io.IOException)5 List (java.util.List)5