Author: julien(a)jboss.com
Date: 2006-12-15 18:25:01 -0500 (Fri, 15 Dec 2006)
New Revision: 5878
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
Log:
JBPortal-1163 : Portlet cache does not take in account window state and modes
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-12-15
23:19:29 UTC (rev 5877)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2006-12-15
23:25:01 UTC (rev 5878)
@@ -34,6 +34,8 @@
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
import java.io.Serializable;
@@ -62,6 +64,8 @@
//
StateString navState = renderCtx.getNavigationalState();
+ WindowState windowState = renderCtx.getWindowState();
+ Mode mode = renderCtx.getMode();
//
CacheEntry cachedEntry = (CacheEntry)resolver.getAttribute(scopeKey);
@@ -102,6 +106,12 @@
{
useEntry = navState.equals(entryNavState);
}
+
+ // Then check window state equality
+ useEntry &= windowState.equals(cachedEntry.getWindowState());
+
+ // Then check mode equality
+ useEntry &= mode.equals(cachedEntry.getMode());
}
// Use the entry
@@ -142,7 +152,7 @@
// Cache if we can
if (expirationTimeMillis > 0)
{
- CacheEntry cacheEntry = new CacheEntry(navState, renderResult,
expirationTimeMillis);
+ CacheEntry cacheEntry = new CacheEntry(navState, windowState, mode,
renderResult, expirationTimeMillis);
resolver.setAttribute(scopeKey, cacheEntry);
}
}
@@ -175,16 +185,24 @@
/** The entry navigational state. */
private final StateString navigationalState;
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private Mode mode;
+
/** The timed content. */
private final TimedContent cachedResult;
- public CacheEntry(StateString navigationalState, FragmentResponse result, long
expirationTimeMillis)
+ public CacheEntry(StateString navigationalState, WindowState windowState, Mode
mode, FragmentResponse result, long expirationTimeMillis)
{
if (expirationTimeMillis <= 0)
{
throw new IllegalArgumentException();
}
this.navigationalState = navigationalState;
+ this.windowState = windowState;
+ this.mode = mode;
this.cachedResult = new StrongTimedContent(result, expirationTimeMillis);
}
@@ -193,6 +211,16 @@
return navigationalState;
}
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
public long getExpirationTimeMillis()
{
return cachedResult.getExpirationTimeMillis();
Show replies by date