Search in sources :

Example 51 with IPortletWindowId

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);
    }
}
Also used : IPortletRenderExecutionWorker(org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 52 with IPortletWindowId

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;
}
Also used : IPortletRenderExecutionWorker(org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 53 with IPortletWindowId

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());
}
Also used : MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockPortletWindowId(org.apereo.portal.mock.portlet.om.MockPortletWindowId) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) Test(org.junit.Test)

Example 54 with IPortletWindowId

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());
}
Also used : MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockPortletWindowId(org.apereo.portal.mock.portlet.om.MockPortletWindowId) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) Test(org.junit.Test)

Example 55 with IPortletWindowId

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());
}
Also used : MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) Test(org.junit.Test)

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