use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortletExecutionManager method afterCompletion.
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletHeaderRenderingMap = this.getPortletHeaderRenderingMap(request);
for (final IPortletRenderExecutionWorker portletRenderExecutionWorker : portletHeaderRenderingMap.values()) {
checkWorkerCompletion(request, portletRenderExecutionWorker);
}
final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletRenderingMap = this.getPortletRenderingMap(request);
for (final IPortletRenderExecutionWorker portletRenderExecutionWorker : portletRenderingMap.values()) {
checkWorkerCompletion(request, portletRenderExecutionWorker);
}
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortletExecutionManager method isPortletRenderRequested.
/* (non-Javadoc)
* @see org.apereo.portal.portlet.rendering.IPortletExecutionManager#isPortletRenderRequested(org.apereo.portal.portlet.om.IPortletWindowId, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public boolean isPortletRenderRequested(IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) {
final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletRenderingMap = this.getPortletRenderingMap(request);
final IPortletRenderExecutionWorker tracker = portletRenderingMap.get(portletWindowId);
return tracker != null;
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class UrlSyntaxProviderImplTest method testLegacyPortletUrlParsingNoParams.
@Test
public void testLegacyPortletUrlParsingNoParams() throws Exception {
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/portal");
request.setRequestURI("/render.userLayoutRootNode.uP");
request.setQueryString("?uP_fname=contact-information");
request.addParameter("uP_fname", "contact-information");
final MockPortletWindowId portletWindowId1 = new MockPortletWindowId("u110l1n41");
when(this.portalRequestUtils.getOriginalPortalRequest(request)).thenReturn(request);
when(this.portletWindowRegistry.getOrCreateDefaultPortletWindowByFname(request, "contact-information")).thenReturn(this.portletWindow1);
when(this.portletWindow1.getPortletWindowId()).thenReturn(portletWindowId1);
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
assertNotNull(portalRequestInfo);
assertNull(portalRequestInfo.getTargetedLayoutNodeId());
assertEquals(portletWindowId1, portalRequestInfo.getTargetedPortletWindowId());
assertEquals(UrlState.MAX, portalRequestInfo.getUrlState());
assertEquals(UrlType.RENDER, portalRequestInfo.getUrlType());
final Map<IPortletWindowId, ? extends IPortletRequestInfo> portletRequestInfoMap = portalRequestInfo.getPortletRequestInfoMap();
assertNotNull(portletRequestInfoMap);
assertEquals(1, portletRequestInfoMap.size());
final IPortletRequestInfo portletRequestInfo = portletRequestInfoMap.get(portletWindowId1);
assertNotNull(portletRequestInfo);
assertEquals(portletWindowId1, portletRequestInfo.getPortletWindowId());
assertEquals(Collections.emptyMap(), portletRequestInfo.getPortletParameters());
assertEquals(WindowState.MAXIMIZED, portletRequestInfo.getWindowState());
assertNull(portletRequestInfo.getDelegateParentWindowId());
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class UrlSyntaxProviderImplTest method testSingleFolderPortletDelegationFnameSubscribeIdMinimizedRenderUrlParsing.
@Test
public void testSingleFolderPortletDelegationFnameSubscribeIdMinimizedRenderUrlParsing() throws Exception {
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/uPortal");
request.setRequestURI("/f/n2/normal/render.uP");
request.setQueryString("?pCt=fname.s3&pCs=minimized&pP_action=dashboard&pCd_pw2=pw1&pCm_pw2=help&pP_pw2_a=b&pP_pw2_b=c&pCa=pw2");
request.addParameter("pCt", "fname.s3");
request.addParameter("pCs", "minimized");
request.addParameter("pP_action", "dashboard");
request.addParameter("pCa", "pw2");
request.addParameter("pCd_pw2", "pw1");
request.addParameter("pCm_pw2", "help");
request.addParameter("pP_pw2_a", "b");
request.addParameter("pP_pw2_b", "c");
request.addParameter("postedParameter", "foobar");
final MockPortletWindowId portletWindowId1 = new MockPortletWindowId("pw1");
final MockPortletWindowId portletWindowId2 = new MockPortletWindowId("pw2");
when(this.portalRequestUtils.getOriginalPortalRequest(request)).thenReturn(request);
when(urlNodeSyntaxHelperRegistry.getCurrentUrlNodeSyntaxHelper(request)).thenReturn(urlNodeSyntaxHelper);
when(this.urlNodeSyntaxHelper.getLayoutNodeForFolderNames(request, Arrays.asList("n2"))).thenReturn("n2");
when(this.urlNodeSyntaxHelper.getPortletForFolderName(request, "n2", "fname.s3")).thenReturn(portletWindowId1);
when(this.portletWindowRegistry.getPortletWindowId(request, "pw2")).thenReturn(portletWindowId2);
when(this.portletWindowRegistry.getPortletWindowId(request, "pw1")).thenReturn(portletWindowId1);
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
assertNotNull(portalRequestInfo);
assertEquals("n2", portalRequestInfo.getTargetedLayoutNodeId());
assertEquals(portletWindowId1, portalRequestInfo.getTargetedPortletWindowId());
assertEquals(UrlState.NORMAL, portalRequestInfo.getUrlState());
assertEquals(UrlType.RENDER, portalRequestInfo.getUrlType());
final Map<IPortletWindowId, ? extends IPortletRequestInfo> portletRequestInfoMap = portalRequestInfo.getPortletRequestInfoMap();
assertNotNull(portletRequestInfoMap);
assertEquals(2, portletRequestInfoMap.size());
final IPortletRequestInfo portletRequestInfo = portletRequestInfoMap.get(portletWindowId1);
assertNotNull(portletRequestInfo);
assertEquals(portletWindowId1, portletRequestInfo.getPortletWindowId());
assertEquals(ImmutableMap.of("action", Arrays.asList("dashboard")), portletRequestInfo.getPortletParameters());
assertEquals(WindowState.MINIMIZED, portletRequestInfo.getWindowState());
assertNull(portletRequestInfo.getPortletMode());
assertNull(portletRequestInfo.getDelegateParentWindowId());
final IPortletRequestInfo portletRequestInfo2 = portletRequestInfoMap.get(portletWindowId2);
assertNotNull(portletRequestInfo2);
assertEquals(portletWindowId2, portletRequestInfo2.getPortletWindowId());
assertEquals(ImmutableMap.of("a", Arrays.asList("b"), "b", Arrays.asList("c"), "postedParameter", Arrays.asList("foobar")), portletRequestInfo2.getPortletParameters());
assertNull(portletRequestInfo2.getWindowState());
assertEquals(PortletMode.HELP, portletRequestInfo2.getPortletMode());
assertEquals(portletWindowId1, portletRequestInfo2.getDelegateParentWindowId());
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class UrlSyntaxProviderImplTest method testLegacyTargetedTabParsing.
@Test
public void testLegacyTargetedTabParsing() throws Exception {
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath("/uPortal");
request.setRequestURI("/render.userLayoutRootNode.uP");
request.setQueryString("?root=uP_root&uP_sparam=activeTab&activeTab=1");
request.addParameter("root", "uP_root");
request.addParameter("uP_sparam", "activeTab");
request.addParameter("activeTab", "1");
when(this.portalRequestUtils.getOriginalPortalRequest(request)).thenReturn(request);
when(this.xpathOperations.doWithExpression(Mockito.eq("/layout/folder/folder[@type='regular' and @hidden='false'][position() = $activeTabId]/@ID"), Mockito.eq(Collections.singletonMap("activeTabId", "1")), Mockito.<Function>anyObject())).thenReturn("n12");
when(this.userInstanceManager.getUserInstance(request)).thenReturn(userInstance);
when(userInstance.getPreferencesManager()).thenReturn(userPreferencesManager);
when(userPreferencesManager.getUserLayoutManager()).thenReturn(userLayoutManager);
when(userLayoutManager.getUserLayout()).thenReturn(userLayout);
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
assertNotNull(portalRequestInfo);
assertEquals("n12", portalRequestInfo.getTargetedLayoutNodeId());
assertNull(portalRequestInfo.getTargetedPortletWindowId());
assertEquals(UrlState.NORMAL, portalRequestInfo.getUrlState());
assertEquals(UrlType.RENDER, portalRequestInfo.getUrlType());
final Map<IPortletWindowId, ? extends IPortletRequestInfo> portletRequestInfoMap = portalRequestInfo.getPortletRequestInfoMap();
assertNotNull(portletRequestInfoMap);
assertEquals(0, portletRequestInfoMap.size());
}
Aggregations