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);
}
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);
}
}
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);
}
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);
}
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;
}
Aggregations