Search in sources :

Example 46 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class LocalPortletRequestContextServiceImpl method getPortletActionResponseContext.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletRequestContextService#getPortletActionResponseContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
     */
@Override
public PortletActionResponseContext getPortletActionResponseContext(PortletContainer container, HttpServletRequest containerRequest, HttpServletResponse containerResponse, PortletWindow window) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(containerRequest, window);
    final IPortalActionUrlBuilder portalActionUrlBuilder = this.portalUrlProvider.getPortalActionUrlBuilder(containerRequest);
    final IPortletUrlBuilder portletUrlBuilder = portalActionUrlBuilder.getPortletUrlBuilder(portletWindow.getPortletWindowId());
    return new PortletActionResponseContextImpl(container, portletWindow, containerRequest, containerResponse, requestPropertiesManager, portalActionUrlBuilder, portletUrlBuilder, this.portletContextService, this.portletCookieService);
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) PortletActionResponseContextImpl(org.apereo.portal.portlet.container.PortletActionResponseContextImpl) IPortalActionUrlBuilder(org.apereo.portal.url.IPortalActionUrlBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 47 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class PortletPreferencesFactoryImpl method createPortletPreferences.

@Override
public PortletPreferences createPortletPreferences(final PortletRequestContext requestContext, boolean render) {
    final HttpServletRequest containerRequest = requestContext.getContainerRequest();
    final PortletWindow plutoPortletWindow = requestContext.getPortletWindow();
    final IPortletWindow portletWindow = portletWindowRegistry.convertPortletWindow(containerRequest, plutoPortletWindow);
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final boolean configMode = IPortletRenderer.CONFIG.equals(portletWindow.getPortletMode());
    if (configMode) {
        final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId();
        return new PortletDefinitionPreferencesImpl(portletDefinitionRegistry, transactionOperations, portletDefinitionId, render);
    } else if (this.isStoreInMemory(containerRequest)) {
        final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
        return new GuestPortletEntityPreferencesImpl(requestContext, portletEntityRegistry, portletDefinitionRegistry, portletEntityId, render);
    } else {
        final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
        return new PortletEntityPreferencesImpl(requestContext, portletEntityRegistry, portletDefinitionRegistry, transactionOperations, portletEntityId, render);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPortletDefinitionId(org.apereo.portal.portlet.om.IPortletDefinitionId) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) PortletWindow(org.apache.pluto.container.PortletWindow) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletEntityId(org.apereo.portal.portlet.om.IPortletEntityId)

Example 48 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class LocalPortletRequestContextServiceImpl method getPortletActionRequestContext.

/* (non-Javadoc)
     * @see org.apache.pluto.container.PortletRequestContextService#getPortletActionRequestContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
     */
@Override
public PortletRequestContext getPortletActionRequestContext(PortletContainer container, HttpServletRequest containerRequest, HttpServletResponse containerResponse, PortletWindow window) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(containerRequest, window);
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(containerRequest);
    return new PortletRequestContextImpl(container, portletWindow, containerRequest, containerResponse, this.requestPropertiesManager, portalRequestInfo, portletCookieService, requestAttributeService);
}
Also used : IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) PortletRequestContextImpl(org.apereo.portal.portlet.container.PortletRequestContextImpl) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 49 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class PortletCacheControlServiceImplTest method testGetCacheControlDefault.

@Test
public void testGetCacheControlDefault() {
    MockHttpServletRequest httpRequest = new MockHttpServletRequest();
    MockPortletWindowId portletWindowId = new MockPortletWindowId("123");
    MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId(789);
    when(portletDescriptor.getCacheScope()).thenReturn(null);
    final IPortletWindowRegistry portletWindowRegistry = mock(IPortletWindowRegistry.class);
    final IPortletWindow portletWindow = mock(IPortletWindow.class);
    final IPortletEntity portletEntity = mock(IPortletEntity.class);
    when(portletWindowRegistry.getPortletWindow(httpRequest, portletWindowId)).thenReturn(portletWindow);
    when(portletWindow.getPortletEntity()).thenReturn(portletEntity);
    when(portletWindow.getWindowState()).thenReturn(WindowState.NORMAL);
    when(portletWindow.getPortletMode()).thenReturn(PortletMode.VIEW);
    when(portletEntity.getPortletDefinitionId()).thenReturn(portletDefinitionId);
    when(portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId)).thenReturn(portletDescriptor);
    final CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> cacheState = cacheControlService.getPortletRenderState(httpRequest, portletWindowId);
    final CacheControl cacheControl = cacheState.getCacheControl();
    assertFalse(cacheControl.isPublicScope());
    assertNull(cacheControl.getETag());
}
Also used : MockPortletDefinitionId(org.apereo.portal.mock.portlet.om.MockPortletDefinitionId) IPortletWindowRegistry(org.apereo.portal.portlet.registry.IPortletWindowRegistry) IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) PortletRenderResult(org.apereo.portal.portlet.rendering.PortletRenderResult) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockPortletWindowId(org.apereo.portal.mock.portlet.om.MockPortletWindowId) CacheControl(javax.portlet.CacheControl) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) Test(org.junit.Test)

Example 50 with IPortletWindow

use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.

the class ThreadNamingPortletExecutionInterceptorAdaptor method getFname.

protected String getFname(HttpServletRequest request, IPortletWindowId portletWindowId) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
    if (portletWindow == null) {
        logger.warn("Failed to resolve IPortletWindow for id: " + portletWindowId + ", the id will be used instead of the fname");
        return portletWindowId.toString();
    }
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
    return portletDefinition.getFName();
}
Also used : IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Aggregations

IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)88 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)32 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)32 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)23 HttpServletRequest (javax.servlet.http.HttpServletRequest)13 IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)12 IUserInstance (org.apereo.portal.user.IUserInstance)12 List (java.util.List)10 IPortletEntityId (org.apereo.portal.portlet.om.IPortletEntityId)10 IPortletUrlBuilder (org.apereo.portal.url.IPortletUrlBuilder)9 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)9 IOException (java.io.IOException)8 IUserLayoutManager (org.apereo.portal.layout.IUserLayoutManager)7 WindowState (javax.portlet.WindowState)6 IUserPreferencesManager (org.apereo.portal.IUserPreferencesManager)6 IPortalUrlBuilder (org.apereo.portal.url.IPortalUrlBuilder)6 LinkedHashMap (java.util.LinkedHashMap)5 Locale (java.util.Locale)5 PortletException (javax.portlet.PortletException)5 PortletMode (javax.portlet.PortletMode)5