use of org.apereo.portal.url.IPortletRequestInfo in project uPortal by Jasig.
the class PortalEventFactoryImpl method getParameters.
protected Map<String, List<String>> getParameters(HttpServletRequest httpServletRequest, IPortletWindowId portletWindowId, boolean renderRequest) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(httpServletRequest);
final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getPortletRequestInfo(portletWindowId);
if (portletRequestInfo != null) {
final Map<String, List<String>> parameters = portletRequestInfo.getPortletParameters();
return pruneParameters(parameters);
}
// Only re-use render parameters on a render request
if (renderRequest) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(httpServletRequest, portletWindowId);
final Map<String, String[]> parameters = portletWindow.getRenderParameters();
return pruneParameters(ParameterMap.immutableCopyOfArrayMap(parameters));
}
return Collections.emptyMap();
}
use of org.apereo.portal.url.IPortletRequestInfo in project uPortal by Jasig.
the class PortletRequestParameterProcessor method processParameters.
/* (non-Javadoc)
* @see org.apereo.portal.url.processing.IRequestParameterProcessor#processParameters(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public boolean processParameters(HttpServletRequest request, HttpServletResponse response) {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final IPortletWindowId targetedPortletWindowId = portalRequestInfo.getTargetedPortletWindowId();
for (final IPortletRequestInfo portletRequestInfo : portalRequestInfo.getPortletRequestInfoMap().values()) {
final IPortletWindowId portletWindowId = portletRequestInfo.getPortletWindowId();
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, targetedPortletWindowId);
final UrlType urlType = portalRequestInfo.getUrlType();
switch(urlType) {
case RENDER:
{
final Map<String, List<String>> portletParameters = portletRequestInfo.getPortletParameters();
portletWindow.setRenderParameters(ParameterMap.convertListMap(portletParameters));
// fall through, render uses state/mode info
}
case ACTION:
{
final WindowState windowState = portletRequestInfo.getWindowState();
if (windowState != null) {
portletWindow.setWindowState(windowState);
}
final PortletMode portletMode = portletRequestInfo.getPortletMode();
if (portletMode != null) {
portletWindow.setPortletMode(portletMode);
}
break;
}
default:
}
// Override the window state of the targeted portlet window based on the url state
if (portletWindowId.equals(targetedPortletWindowId)) {
final UrlState urlState = portalRequestInfo.getUrlState();
switch(urlState) {
case MAX:
{
portletWindow.setWindowState(WindowState.MAXIMIZED);
break;
}
case DETACHED:
{
portletWindow.setWindowState(IPortletRenderer.DETACHED);
break;
}
case EXCLUSIVE:
{
portletWindow.setWindowState(IPortletRenderer.EXCLUSIVE);
break;
}
default:
}
}
this.portletWindowRegistry.storePortletWindow(request, portletWindow);
}
return true;
}
use of org.apereo.portal.url.IPortletRequestInfo 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.url.IPortletRequestInfo 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.url.IPortletRequestInfo in project uPortal by Jasig.
the class PortalController method actionRequest.
/**
* HTTP POST required for security.
*/
@RequestMapping(headers = { "org.apereo.portal.url.UrlType=ACTION" }, method = RequestMethod.POST)
public void actionRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final IPortletRequestInfo portletRequestInfo = portalRequestInfo.getTargetedPortletRequestInfo();
final IPortalUrlBuilder actionRedirectUrl;
if (portletRequestInfo != null) {
final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
actionRedirectUrl = this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(request, targetWindowId, UrlType.RENDER);
} else {
final String targetedLayoutNodeId = portalRequestInfo.getTargetedLayoutNodeId();
if (targetedLayoutNodeId != null) {
actionRedirectUrl = this.portalUrlProvider.getPortalUrlBuilderByLayoutNode(request, targetedLayoutNodeId, UrlType.RENDER);
} else {
actionRedirectUrl = this.portalUrlProvider.getDefaultUrl(request);
}
}
// Stuff the action-redirect URL builder into the request so other code can use it during
// request processing
this.portalUrlProvider.convertToPortalActionUrlBuilder(request, actionRedirectUrl);
if (portletRequestInfo != null) {
final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
try {
this.portletExecutionManager.doPortletAction(targetWindowId, request, response);
} catch (RuntimeException e) {
this.logger.error("Exception thrown while executing portlet action for: " + portletRequestInfo, e);
// TODO this should be a constant right?
actionRedirectUrl.setParameter("portletActionError", targetWindowId.toString());
}
}
sendRedirect(actionRedirectUrl, response);
}
Aggregations