use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class XsltPortalUrlProvider method getPortletUrlBuilder.
/**
* Get the portlet URL builder for the specified fname or layoutId (fname takes precedence)
*
* @param request
* @param portalUrlBuilder
* @param fname - can be empty string
* @param layoutId - can by empty string
* @param state - can be empty string
* @param mode - can be empty string
* @param copyCurrentRenderParameters
* @param resourceId - can be empty string
* @return IPortletUrlBuilder
* @since 4.1
*/
public IPortletUrlBuilder getPortletUrlBuilder(HttpServletRequest request, IPortalUrlBuilder portalUrlBuilder, String fname, String layoutId, String state, String mode, String copyCurrentRenderParameters, String resourceId) {
final IPortletUrlBuilder portletUrlBuilder;
if (StringUtils.isNotEmpty(fname)) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(request, fname);
final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
} else if (StringUtils.isNotEmpty(layoutId)) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByLayoutNodeId(request, layoutId);
final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(portletWindowId);
} else {
final IPortletWindowId targetPortletWindowId = portalUrlBuilder.getTargetPortletWindowId();
if (targetPortletWindowId == null) {
if (this.logger.isDebugEnabled()) {
this.logger.warn("Can only target the default portlet if the root portal-url targets a portlet.", new Throwable());
} else {
this.logger.warn("Can only target the default portlet if the root portal-url targets a portlet. Enable debug for stack trace.");
}
return new FailSafePortletUrlBuilder(null, portalUrlBuilder);
}
portletUrlBuilder = portalUrlBuilder.getTargetedPortletUrlBuilder();
}
portletUrlBuilder.setCopyCurrentRenderParameters(Boolean.parseBoolean(copyCurrentRenderParameters));
if (StringUtils.isNotEmpty(state)) {
portletUrlBuilder.setWindowState(PortletUtils.getWindowState(state));
}
if (StringUtils.isNotEmpty(mode)) {
portletUrlBuilder.setPortletMode(PortletUtils.getPortletMode(mode));
}
if (StringUtils.isNotEmpty(resourceId) && portletUrlBuilder.getPortalUrlBuilder().getUrlType() == UrlType.RESOURCE) {
portletUrlBuilder.setResourceId(resourceId);
}
return portletUrlBuilder;
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortalController method renderExclusive.
@RequestMapping(headers = { "org.apereo.portal.url.UrlType=RENDER", "org.apereo.portal.url.UrlState.EXCLUSIVE=true" })
public void renderExclusive(HttpServletRequest request, HttpServletResponse response) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getTargetedPortletRequestInfo();
if (portletRequestInfo == null) {
throw new IllegalArgumentException("A portlet must be targeted when using the EXCLUSIVE WindowState: " + portalRequestInfo);
}
final IPortletWindowId portletWindowId = portletRequestInfo.getPortletWindowId();
this.portletExecutionManager.getPortletOutput(portletWindowId, request, response);
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortalController method resourceRequest.
@RequestMapping(headers = { "org.apereo.portal.url.UrlType=RESOURCE" })
public void resourceRequest(HttpServletRequest request, HttpServletResponse response) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getTargetedPortletRequestInfo();
if (portletRequestInfo != null) {
final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
this.portletExecutionManager.doPortletServeResource(targetWindowId, request, response);
} else {
this.logger.error("portletRequestInfo was null for resourceRequest");
}
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortletDefinitionAttributeSource method getCacheKey.
@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.name);
// We need something that makes for a unique cache key. For lack of anything else useful,
// use the set of all layout portlet window ids in the user's layout.
final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllLayoutPortletWindows(request);
for (final IPortletWindow portletWindow : portletWindows) {
if (portletWindow != null) {
final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
cacheKeyBuilder.add(portletWindowId);
} else {
this.logger.warn("portletWindowRegistry#getAllLayoutPortletWindows() returned a null portletWindow");
}
}
return cacheKeyBuilder.build();
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class RequestRenderingPipelineUtilsImpl method getPortletDefinitionFromServletRequest.
@Override
public IPortletDefinition getPortletDefinitionFromServletRequest(HttpServletRequest request) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
if (portalRequestInfo != null && portalRequestInfo.getTargetedPortletWindowId() != null) {
IPortletWindowId targetedPortletWindowId = portalRequestInfo.getTargetedPortletWindowId();
IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, targetedPortletWindowId);
if (portletWindow != null && portletWindow.getPortletEntity() != null) {
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
return portletDefinition;
}
}
return null;
}
Aggregations