use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletCacheControlServiceImpl method getPortletRenderHeaderState.
@Override
public CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> getPortletRenderHeaderState(HttpServletRequest request, IPortletWindowId portletWindowId) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
if (portletWindow == null) {
logger.warn("portletWindowRegistry returned null for {}, returning default cacheControl and no cached portlet data", portletWindowId);
return new CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult>();
}
//Generate the public render-header cache key
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final Locale locale = RequestContextUtils.getLocale(request);
final PublicPortletCacheKey publicCacheKey = PublicPortletCacheKey.createPublicPortletRenderHeaderCacheKey(portletWindow, portalRequestInfo, locale);
return this.<CachedPortletData<PortletRenderResult>, PortletRenderResult>getPortletState(request, portletWindow, publicCacheKey, this.publicScopePortletRenderHeaderOutputCache, this.privateScopePortletRenderHeaderOutputCache, false);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletCacheControlServiceImpl method cachePortletOutput.
private <D extends CachedPortletResultHolder<T>, T extends Serializable> void cachePortletOutput(IPortletWindowId portletWindowId, HttpServletRequest httpRequest, CacheState<D, T> cacheState, D cachedPortletData, Ehcache publicOutputCache, Ehcache privateOutputCache) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(httpRequest, portletWindowId);
final CacheControl cacheControl = cacheState.getCacheControl();
if (cacheControl.isPublicScope()) {
final PublicPortletCacheKey publicCacheKey = cacheState.getPublicPortletCacheKey();
this.cacheElement(publicOutputCache, publicCacheKey, cachedPortletData, cacheControl);
logger.debug("Cached public data under key {} for {}", publicCacheKey, portletWindow);
} else {
PrivatePortletCacheKey privateCacheKey = cacheState.getPrivatePortletCacheKey();
//Private key can be null if getPortletState found publicly cached data but the portlet's response is now privately scoped
if (privateCacheKey == null) {
final HttpSession session = httpRequest.getSession();
final String sessionId = session.getId();
final IPortletEntityId entityId = portletWindow.getPortletEntityId();
final PublicPortletCacheKey publicCacheKey = cacheState.getPublicPortletCacheKey();
privateCacheKey = new PrivatePortletCacheKey(sessionId, portletWindowId, entityId, publicCacheKey);
}
this.cacheElement(privateOutputCache, privateCacheKey, cachedPortletData, cacheControl);
logger.debug("Cached private data under key {} for {}", privateCacheKey, portletWindow);
}
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class LocalPortletRequestContextServiceImpl method getPortletResourceRequestContext.
/* (non-Javadoc)
* @see org.apache.pluto.container.PortletRequestContextService#getPortletResourceRequestContext(org.apache.pluto.container.PortletContainer, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.pluto.container.PortletWindow)
*/
@Override
public PortletResourceRequestContext getPortletResourceRequestContext(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 PortletResourceRequestContextImpl(container, portletWindow, containerRequest, containerResponse, this.requestPropertiesManager, portalRequestInfo, this.portletCookieService, requestAttributeService);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletCacheControlServiceImpl method getPortletRenderState.
@Override
public CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult> getPortletRenderState(HttpServletRequest request, IPortletWindowId portletWindowId) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
if (portletWindow == null) {
logger.warn("portletWindowRegistry returned null for {}, returning default cacheControl and no cached portlet data", portletWindowId);
return new CacheState<CachedPortletData<PortletRenderResult>, PortletRenderResult>();
}
//Generate the public render cache key
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
final Locale locale = RequestContextUtils.getLocale(request);
final PublicPortletCacheKey publicCacheKey = PublicPortletCacheKey.createPublicPortletRenderCacheKey(portletWindow, portalRequestInfo, locale);
return this.<CachedPortletData<PortletRenderResult>, PortletRenderResult>getPortletState(request, portletWindow, publicCacheKey, this.publicScopePortletRenderOutputCache, this.privateScopePortletRenderOutputCache, false);
}
use of org.apereo.portal.portlet.om.IPortletWindow in project uPortal by Jasig.
the class PortletRendererImpl method doEvent.
/*
* PLT 22.1 If the content of a portlet is cached and the portlet is target of request
* with an action-type semantic (e.g. an action or event call), the portlet container should discard the cache and
* invoke the corresponding request handling methods of the portlet like processAction,or processEvent.
*
* (non-Javadoc)
* @see org.apereo.portal.portlet.rendering.IPortletRenderer#doEvent(org.apereo.portal.portlet.om.IPortletWindowId, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.portlet.Event)
*/
@Override
public long doEvent(IPortletWindowId portletWindowId, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Event event) {
this.portletCacheControlService.purgeCachedPortletData(portletWindowId, httpServletRequest);
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(httpServletRequest, portletWindowId);
enforceConfigPermission(httpServletRequest, portletWindow);
httpServletRequest = this.setupPortletRequest(httpServletRequest);
httpServletResponse = new PortletHttpServletResponseWrapper(httpServletResponse, portletWindow);
//Execute the action,
this.logger.debug("Executing portlet event for window '{}'", portletWindow);
final long start = System.nanoTime();
try {
this.portletContainer.doEvent(portletWindow.getPlutoPortletWindow(), httpServletRequest, httpServletResponse, event);
} catch (PortletException pe) {
throw new PortletDispatchException("The portlet window '" + portletWindow + "' threw an exception while executing event.", portletWindow, pe);
} catch (PortletContainerException pce) {
throw new PortletDispatchException("The portlet container threw an exception while executing event on portlet window '" + portletWindow + "'.", portletWindow, pce);
} catch (IOException ioe) {
throw new PortletDispatchException("The portlet window '" + portletWindow + "' threw an exception while executing event.", portletWindow, ioe);
}
final long executionTime = System.nanoTime() - start;
this.portalEventFactory.publishPortletEventExecutionEvent(httpServletRequest, this, portletWindowId, executionTime, event.getQName());
return executionTime;
}
Aggregations