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);
}
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);
}
}
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);
}
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());
}
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();
}
Aggregations