Author: julien(a)jboss.com
Date: 2008-02-09 12:34:08 -0500 (Sat, 09 Feb 2008)
New Revision: 9909
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml
Log:
- use caching in google portlets
- implements public nav state caching in consumer cache interceptor
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-09
17:12:18 UTC (rev 9908)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-09
17:34:08 UTC (rev 9909)
@@ -35,6 +35,7 @@
import org.jboss.portal.portlet.cache.CacheControl;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -64,7 +65,8 @@
RenderInvocation renderInvocation = (RenderInvocation)invocation;
//
- StateString navState = renderInvocation.getNavigationalState();
+ StateString navigationalState = renderInvocation.getNavigationalState();
+ ParameterMap publicNavigationalState =
renderInvocation.getPublicNavigationalState();
WindowState windowState = renderInvocation.getWindowState();
Mode mode = renderInvocation.getMode();
@@ -76,33 +78,58 @@
{
// Check time validity for fragment
boolean useEntry = false;
- StateString entryNavState = cachedEntry.navigationalState;
+ StateString entryNavigationalState = cachedEntry.navigationalState;
+ ParameterMap entryPublicNavigationalState =
cachedEntry.publicNavigationalState;
// Then check nav state equality
- if (navState == null)
+ if (navigationalState == null)
{
- if (entryNavState == null)
+ if (entryNavigationalState == null)
{
useEntry = true;
}
- else if (entryNavState instanceof ParametersStateString)
+ else if (entryNavigationalState instanceof ParametersStateString)
{
// We consider a parameters state string empty equivalent to a null
value
- useEntry = ((ParametersStateString)entryNavState).getSize() == 0;
+ useEntry = ((ParametersStateString)entryNavigationalState).getSize() ==
0;
}
}
- else if (entryNavState == null)
+ else if (entryNavigationalState == null)
{
- if (navState instanceof ParametersStateString)
+ if (navigationalState instanceof ParametersStateString)
{
- useEntry = ((ParametersStateString)navState).getSize() == 0;
+ useEntry = ((ParametersStateString)navigationalState).getSize() == 0;
}
}
else
{
- useEntry = navState.equals(entryNavState);
+ useEntry = navigationalState.equals(entryNavigationalState);
}
+ // Check public nav state equality
+ if (useEntry)
+ {
+ if (publicNavigationalState == null)
+ {
+ if (entryPublicNavigationalState == null)
+ {
+ //
+ }
+ else
+ {
+ useEntry = entryPublicNavigationalState.size() == 0;
+ }
+ }
+ else if (entryPublicNavigationalState == null)
+ {
+ useEntry = publicNavigationalState.size() == 0;
+ }
+ else
+ {
+ useEntry =
publicNavigationalState.equals(entryPublicNavigationalState);
+ }
+ }
+
// Then check window state equality
useEntry &= windowState.equals(cachedEntry.windowState);
@@ -173,7 +200,8 @@
if (expirationTimeMillis > 0)
{
CacheEntry cacheEntry = new CacheEntry(
- navState,
+ navigationalState,
+ publicNavigationalState,
windowState,
mode,
fragment,
@@ -216,6 +244,9 @@
/** . */
private final Mode mode;
+ /** . */
+ private final ParameterMap publicNavigationalState;
+
/** The timed content. */
private final ContentRef contentRef;
@@ -227,6 +258,7 @@
public CacheEntry(
StateString navigationalState,
+ ParameterMap publicNavigationalState,
WindowState windowState,
Mode mode,
FragmentResponse content,
@@ -240,6 +272,7 @@
this.navigationalState = navigationalState;
this.windowState = windowState;
this.mode = mode;
+ this.publicNavigationalState = publicNavigationalState;
this.contentRef = new StrongContentRef(content);
this.expirationTimeMillis = expirationTimeMillis;
this.validationToken = validationToken;
Modified:
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml 2008-02-09
17:12:18 UTC (rev 9908)
+++
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml 2008-02-09
17:34:08 UTC (rev 9909)
@@ -30,6 +30,7 @@
<portlet-name>GoogleMap</portlet-name>
<display-name>Google Map Portlet</display-name>
<portlet-class>org.jboss.portal.simple.samples.GoogleClippingPortlet</portlet-class>
+ <expiration-cache>120</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Modified:
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-09
17:12:18 UTC (rev 9908)
+++
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-09
17:34:08 UTC (rev 9909)
@@ -30,6 +30,7 @@
<portlet-name>GoogleWeather</portlet-name>
<display-name>Google Weather Portlet</display-name>
<portlet-class>org.jboss.portal.simple.samples.GoogleWeatherClippingPortlet</portlet-class>
+ <expiration-cache>120</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Show replies by date