Search in sources :

Example 81 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 82 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 83 with IPortletWindowId

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

the class PortletDelegationDispatcherImpl method setupDelegateRequestInfo.

protected void setupDelegateRequestInfo(HttpServletRequest request, DelegationRequest delegationRequest) {
    if (delegationRequest == null) {
        return;
    }
    final DelegateState delegateState = delegationRequest.getDelegateState();
    if (delegateState != null) {
        final PortletMode portletMode = delegateState.getPortletMode();
        if (portletMode != null) {
            this.portletWindow.setPortletMode(portletMode);
        }
        final WindowState windowState = delegateState.getWindowState();
        if (windowState != null) {
            this.portletWindow.setWindowState(windowState);
        }
    }
    final IPortletWindowId portletWindowId = this.portletWindow.getPortletWindowId();
    //Store the DelegationRequest so it can be accessed elsewhere
    this.portletDelegationManager.setDelegationRequest(request, portletWindowId, delegationRequest);
}
Also used : WindowState(javax.portlet.WindowState) DelegateState(org.apereo.portal.api.portlet.DelegateState) PortletMode(javax.portlet.PortletMode) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 84 with IPortletWindowId

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

the class PortletDelegationLocatorImpl method getRequestDispatcher.

/* (non-Javadoc)
     * @see org.apereo.portal.api.portlet.PortletDelegationLocator#getRequestDispatcher(org.apereo.portal.portlet.om.IPortletWindowId)
     */
@Override
public PortletDelegationDispatcher getRequestDispatcher(PortletRequest portletRequest, IPortletWindowId portletWindowId) {
    final HttpServletRequest request = this.portalRequestUtils.getPortletHttpRequest(portletRequest);
    final IPerson person = this.personManager.getPerson(request);
    final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
    final IPortletWindowId delegationParentId = portletWindow.getDelegationParentId();
    if (delegationParentId == null) {
        throw new IllegalArgumentException("Portlet window '" + portletWindow + "' is not a delegate window and cannot be delgated to.");
    }
    return new PortletDelegationDispatcherImpl(portletWindow, person.getID(), this.portalRequestUtils, this.personManager, this.portletRenderer, this.portalUrlProvider, this.portletDelegationManager);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPerson(org.apereo.portal.security.IPerson) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 85 with IPortletWindowId

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

the class MarketplaceSearchService method getSearchResults.

/**
     * Returns a list of search results that pertain to the marketplace query is the query to search
     * will search name, title, description, fname, and captions
     */
@Override
public SearchResults getSearchResults(PortletRequest request, SearchRequest query) {
    final String queryString = query.getSearchTerms().toLowerCase();
    final List<IPortletDefinition> portlets = portletDefinitionRegistry.getAllPortletDefinitions();
    final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    final SearchResults results = new SearchResults();
    for (IPortletDefinition portlet : portlets) {
        if (this.matches(queryString, new MarketplacePortletDefinition(portlet, this.marketplaceService, this.portletCategoryRegistry))) {
            final SearchResult result = new SearchResult();
            result.setTitle(portlet.getTitle());
            result.setSummary(portlet.getDescription());
            result.getType().add("marketplace");
            final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(httpServletRequest, portlet.getFName());
            // If user does not have browse permission, exclude the portlet.
            if (portletWindow != null && authorizationService.canPrincipalBrowse(authorizationService.newPrincipal(request.getRemoteUser(), EntityEnum.PERSON.getClazz()), portlet)) {
                final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
                final IPortalUrlBuilder portalUrlBuilder = this.portalUrlProvider.getPortalUrlBuilderByPortletFName(httpServletRequest, portlet.getFName(), UrlType.RENDER);
                final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
                portletUrlBuilder.setWindowState(PortletUtils.getWindowState("maximized"));
                result.setExternalUrl(portalUrlBuilder.getUrlString());
                PortletUrl url = new PortletUrl();
                url.setType(PortletUrlType.RENDER);
                url.setPortletMode("VIEW");
                url.setWindowState("maximized");
                PortletUrlParameter actionParam = new PortletUrlParameter();
                actionParam.setName("action");
                actionParam.getValue().add("view");
                url.getParam().add(actionParam);
                PortletUrlParameter fNameParam = new PortletUrlParameter();
                fNameParam.setName("fName");
                fNameParam.getValue().add(portlet.getFName());
                url.getParam().add(fNameParam);
                result.setPortletUrl(url);
                //Add the result to list to return
                results.getSearchResult().add(result);
            }
        }
    }
    return results;
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) SearchResult(org.apereo.portal.search.SearchResult) SearchResults(org.apereo.portal.search.SearchResults) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) HttpServletRequest(javax.servlet.http.HttpServletRequest) PortletUrlParameter(org.apereo.portal.search.PortletUrlParameter) PortletUrl(org.apereo.portal.search.PortletUrl) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

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)10 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)9 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)9 PortletMode (javax.portlet.PortletMode)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