Author: julien(a)jboss.com
Date: 2008-01-25 10:55:50 -0500 (Fri, 25 Jan 2008)
New Revision: 9607
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheControl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheLevel.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheScope.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/CacheControlImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RevalidateMarkupResponse.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/CacheabilityType.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/ResourceURL.java
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/ProducerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java
Log:
refactor to start to add support for cache control
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/CacheabilityType.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/CacheabilityType.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/CacheabilityType.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -1,34 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public enum CacheabilityType
-{
-
- FULL, PORTLET, PAGE
-
-}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/ResourceURL.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/ResourceURL.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/ResourceURL.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet;
+import org.jboss.portal.portlet.cache.CacheLevel;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -48,6 +50,6 @@
*
* @return the resource cacheability
*/
- CacheabilityType getCacheability();
+ CacheLevel getCacheability();
}
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-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -31,6 +31,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.cache.CacheControl;
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
@@ -138,22 +139,29 @@
{
FragmentResponse renderResult = (FragmentResponse)response;
- // Compute expiration time, i.e when it will expire
- long expirationTimeMillis = 0;
- if (renderResult.getExpirationSecs() == -1)
+ //
+ CacheControl control = renderResult.getCacheControl();
+
+ //
+ if (control != null)
{
- expirationTimeMillis = Long.MAX_VALUE;
- }
- else if (renderResult.getExpirationSecs() > 0)
- {
- expirationTimeMillis = System.currentTimeMillis() +
renderResult.getExpirationSecs() * 1000;
- }
+ // Compute expiration time, i.e when it will expire
+ long expirationTimeMillis = 0;
+ if (control.getExpirationSecs() == -1)
+ {
+ expirationTimeMillis = Long.MAX_VALUE;
+ }
+ else if (control.getExpirationSecs() > 0)
+ {
+ expirationTimeMillis = System.currentTimeMillis() +
control.getExpirationSecs() * 1000;
+ }
- // Cache if we can
- if (expirationTimeMillis > 0)
- {
- CacheEntry cacheEntry = new CacheEntry(navState, windowState, mode,
renderResult, expirationTimeMillis);
- resolver.setAttribute(scopeKey, cacheEntry);
+ // Cache if we can
+ if (expirationTimeMillis > 0)
+ {
+ CacheEntry cacheEntry = new CacheEntry(navState, windowState, mode,
renderResult, expirationTimeMillis);
+ resolver.setAttribute(scopeKey, cacheEntry);
+ }
}
}
@@ -194,7 +202,12 @@
/** The timed content. */
private final TimedContent cachedResult;
- public CacheEntry(StateString navigationalState, WindowState windowState, Mode
mode, FragmentResponse result, long expirationTimeMillis)
+ public CacheEntry(
+ StateString navigationalState,
+ WindowState windowState,
+ Mode mode,
+ FragmentResponse result,
+ long expirationTimeMillis)
{
if (expirationTimeMillis <= 0)
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -23,19 +23,8 @@
package org.jboss.portal.portlet.aspects.portlet;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.portlet.info.CacheInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.ResponseProperties;
-import org.jboss.portal.portlet.container.PortletContainerInvoker;
-import org.jboss.portal.portlet.container.PortletContainer;
import org.apache.log4j.Logger;
/**
@@ -50,70 +39,6 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- if (invocation instanceof ActionInvocation)
- {
- // Invoke
- return invocation.invokeNext();
- }
- else if (invocation instanceof EventInvocation)
- {
- // Invoke
- return invocation.invokeNext();
- }
- else if (invocation instanceof ResourceInvocation)
- {
- // Invoke
- return invocation.invokeNext();
- }
- else if (invocation instanceof RenderInvocation)
- {
- // Invoke
- PortletInvocationResponse response =
(PortletInvocationResponse)invocation.invokeNext();
-
- //
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragmentResult = (FragmentResponse)response;
-
- // Get config
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
- PortletInfo info = container.getInfo();
- CacheInfo cacheInfo = info.getCache();
-
- // Update the fragment cache info from the meta info
- fragmentResult.setExpirationSecs(cacheInfo.getExpirationSecs());
-
- // Override with value provided by portlet if any
- String portletValue = null;
- ResponseProperties props = fragmentResult.getProperties();
- if (props != null)
- {
- portletValue =
props.getTransportHeaders().getValue("portlet.expiration-cache");
- }
-
- //
- if (portletValue != null)
- {
- try
- {
- int expirationSecs = Integer.parseInt(portletValue);
- fragmentResult.setExpirationSecs(expirationSecs);
- }
- catch (NumberFormatException e)
- {
- log.warn("Portlet " + invocation.getTarget() +
- " set a non integer cache value override during render
" + portletValue, e);
- }
- }
-
- }
-
- //
- return response;
- }
- else
- {
- throw new InvocationException("impossible");
- }
+ return invocation.invokeNext();
}
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheControl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheControl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheControl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.cache;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CacheControl
+{
+
+ /** Number of seconds this result remains valid, a value of -1 indicates that it never
expires. */
+ private int expirationSecs;
+
+ /** The cache scope for this fragment. */
+ private CacheScope cacheScope;
+
+ /** The validation token. */
+ private String token;
+
+ public CacheControl(int expirationSecs, CacheScope cacheScope, String token)
+ {
+ this.expirationSecs = expirationSecs;
+ this.cacheScope = cacheScope;
+ this.token = token;
+ }
+
+ public int getExpirationSecs()
+ {
+ return expirationSecs;
+ }
+
+ public void setExpirationSecs(int expirationSecs)
+ {
+ this.expirationSecs = expirationSecs;
+ }
+
+ public CacheScope getCacheScope()
+ {
+ return cacheScope;
+ }
+
+ public void setCacheScope(CacheScope cacheScope)
+ {
+ this.cacheScope = cacheScope;
+ }
+
+ public String getToken()
+ {
+ return token;
+ }
+
+ public void setToken(String token)
+ {
+ this.token = token;
+ }
+
+ public CacheControl unmodifiable()
+ {
+ return new CacheControl(expirationSecs, cacheScope, token)
+ {
+ public void setCacheScope(CacheScope cacheScope)
+ {
+ throw new UnsupportedOperationException("Not modifiable");
+ }
+
+ public void setToken(String token)
+ {
+ throw new UnsupportedOperationException("Not modifiable");
+ }
+
+ public void setExpirationSecs(int expirationSecs)
+ {
+ throw new UnsupportedOperationException("Not modifiable");
+ }
+ };
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheLevel.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheLevel.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheLevel.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.cache;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public enum CacheLevel
+{
+
+ FULL, PORTLET, PAGE
+
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheScope.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheScope.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/cache/CacheScope.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.cache;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public enum CacheScope
+{
+
+ PUBLIC, PRIVATE
+
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/CacheControlImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/CacheControlImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/CacheControlImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168.api;
+
+import org.jboss.portal.portlet.cache.CacheScope;
+
+import javax.portlet.CacheControl;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CacheControlImpl implements CacheControl
+{
+
+ /** . */
+ private org.jboss.portal.portlet.cache.CacheControl delegate;
+
+ /** . */
+ private boolean useCachedContent;
+
+ public CacheControlImpl(org.jboss.portal.portlet.cache.CacheControl delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public int getExpirationTime()
+ {
+ return delegate.getExpirationSecs();
+ }
+
+ public void setExpirationTime(int expirationTime)
+ {
+ delegate.setExpirationSecs(expirationTime);
+ }
+
+ public boolean isPublicScope()
+ {
+ return delegate.getCacheScope() == CacheScope.PUBLIC;
+ }
+
+ public void setPublicScope(boolean publicScope)
+ {
+ delegate.setCacheScope(publicScope ? CacheScope.PUBLIC : CacheScope.PRIVATE);
+ }
+
+ public String getETag()
+ {
+ return delegate.getToken();
+ }
+
+ public void setETag(String etag)
+ {
+ delegate.setToken(etag);
+ }
+
+ public boolean useCachedContent()
+ {
+ return useCachedContent;
+ }
+
+ public void setUseCachedContent(boolean useCachedContent)
+ {
+ this.useCachedContent = useCachedContent;
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -25,9 +25,12 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.RevalidateMarkupResponse;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.CacheInfo;
+import org.jboss.portal.portlet.cache.CacheScope;
import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.common.util.ContentInfo;
-import org.jboss.portal.common.NotYetImplemented;
import javax.portlet.MimeResponse;
import javax.portlet.PortletURL;
@@ -47,31 +50,57 @@
{
/** The fragment result. */
- protected FragmentResponse result;
+ protected FragmentResponse fragment;
/** Not really used but we need it to memorize what the client set optionally. */
protected int bufferSize;
+ /** The cache control. */
+ protected CacheControlImpl cacheControl;
+
public MimeResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
super(invocation, preq);
+ //
+ FragmentResponse fragment = new FragmentResponse();
+
+ // Configure expiration value
+ PortletInfo info = preq.container.getInfo();
+ CacheInfo cacheInfo = info.getCache();
+
+ org.jboss.portal.portlet.cache.CacheControl cc = new
org.jboss.portal.portlet.cache.CacheControl(
+ cacheInfo.getExpirationSecs(),
+ CacheScope.PRIVATE,
+ null
+ );
+
+ //
+ fragment.setCacheControl(cc);
+
// 0 means no buffering - we say no buffering
this.bufferSize = 0;
- this.result = new FragmentResponse();
+ this.fragment = fragment;
}
public PortletInvocationResponse getResponse()
{
- result.setProperties(getProperties(false));
+ if (cacheControl != null && cacheControl.useCachedContent())
+ {
+ return new RevalidateMarkupResponse(fragment.getCacheControl());
+ }
+ else
+ {
+ fragment.setProperties(getProperties(false));
- //
- return result;
+ //
+ return fragment;
+ }
}
public String getContentType()
{
- return result.getContentType();
+ return fragment.getContentType();
}
public void setContentType(String contentType)
@@ -99,7 +128,7 @@
}
// Set the content type
- result.setContentType(contentType);
+ fragment.setContentType(contentType);
}
catch (MimeTypeParseException e)
{
@@ -111,12 +140,12 @@
public PrintWriter getWriter() throws IOException
{
- return result.getWriter();
+ return fragment.getWriter();
}
public OutputStream getPortletOutputStream() throws IOException
{
- return result.getOutputStream();
+ return fragment.getOutputStream();
}
public PortletURL createRenderURL()
@@ -159,7 +188,7 @@
public void resetBuffer()
{
// Clear the buffer
- result.resetBuffer();
+ fragment.resetBuffer();
}
public void reset()
@@ -182,8 +211,39 @@
return ResourceURLImpl.createResourceURL(invocation, preq);
}
+ public void addProperty(String key, String value) throws IllegalArgumentException
+ {
+ if (MimeResponse.EXPIRATION_CACHE.equals(key))
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ //
+ try
+ {
+ int expirationSecs = Integer.parseInt(value);
+ fragment.getCacheControl().setExpirationSecs(expirationSecs);
+ }
+ catch (NumberFormatException e)
+ {
+ // todo: Make the portlet log instead
+// log.warn("Portlet " + invocation.getTarget() +
+// " set a non integer cache value override during render "
+ value, e);
+ }
+ }
+
+ //
+ super.addProperty(key, value);
+ }
+
public CacheControl getCacheControl()
{
- throw new NotYetImplemented();
+ if (cacheControl == null)
+ {
+ cacheControl = new CacheControlImpl(fragment.getCacheControl());
+ }
+ return cacheControl;
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -91,17 +91,7 @@
public void setProperty(String key, String value) throws IllegalArgumentException
{
- if (key == null)
- {
- throw new IllegalArgumentException("Name cannot be null");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("Value cannot be null");
- }
-
- //
- getProperties().getTransportHeaders().setValue(key, value);
+ addProperty(key, value);
}
public void addProperty(Cookie cookie)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -43,7 +43,7 @@
public void setTitle(String s)
{
- result.setTitle(s);
+ fragment.setTitle(s);
}
public void setNextPossiblePortletModes(Collection<PortletMode> portletModes)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -22,9 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import javax.portlet.ResourceResponse;
import javax.portlet.PortletURL;
@@ -38,7 +37,7 @@
{
/** . */
- private final CacheabilityType cacheability;
+ private final CacheLevel cacheability;
public ResourceResponseImpl(ResourceInvocation invocation, PortletRequestImpl preq)
{
@@ -65,10 +64,10 @@
public PortletURL createActionURL()
{
- if (cacheability != CacheabilityType.PAGE)
+ if (cacheability != CacheLevel.PAGE)
{
throw new IllegalStateException("Cannot create action URL because the
current cache level " + cacheability +
- " is not " + CacheabilityType.PAGE);
+ " is not " + CacheLevel.PAGE);
}
//
@@ -77,10 +76,10 @@
public PortletURL createRenderURL()
{
- if (cacheability != CacheabilityType.PAGE)
+ if (cacheability != CacheLevel.PAGE)
{
throw new IllegalStateException("Cannot create render URL because the
current cache level " + cacheability +
- " is not " + CacheabilityType.PAGE);
+ " is not " + CacheLevel.PAGE);
}
//
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
@@ -40,26 +40,26 @@
{
/** . */
- private static final Map<String, CacheabilityType> jsr168ToType = new
HashMap<String, CacheabilityType>();
+ private static final Map<String, CacheLevel> jsr168ToType = new
HashMap<String, CacheLevel>();
/** . */
- private static final Map<CacheabilityType, String> typetoJSR168 = new
HashMap<CacheabilityType, String>();
+ private static final Map<CacheLevel, String> typetoJSR168 = new
HashMap<CacheLevel, String>();
static
{
- jsr168ToType.put(ResourceURL.FULL, CacheabilityType.FULL);
- jsr168ToType.put(ResourceURL.PAGE, CacheabilityType.PAGE);
- jsr168ToType.put(ResourceURL.PORTLET, CacheabilityType.PORTLET);
+ jsr168ToType.put(ResourceURL.FULL, CacheLevel.FULL);
+ jsr168ToType.put(ResourceURL.PAGE, CacheLevel.PAGE);
+ jsr168ToType.put(ResourceURL.PORTLET, CacheLevel.PORTLET);
//
- typetoJSR168.put(CacheabilityType.FULL, ResourceURL.FULL);
- typetoJSR168.put(CacheabilityType.PAGE, ResourceURL.PAGE);
- typetoJSR168.put(CacheabilityType.PORTLET, ResourceURL.PORTLET);
+ typetoJSR168.put(CacheLevel.FULL, ResourceURL.FULL);
+ typetoJSR168.put(CacheLevel.PAGE, ResourceURL.PAGE);
+ typetoJSR168.put(CacheLevel.PORTLET, ResourceURL.PORTLET);
}
- public static String toJSR168(CacheabilityType cacheabilityType)
+ public static String toJSR168(CacheLevel cacheLevel)
{
- return typetoJSR168.get(cacheabilityType);
+ return typetoJSR168.get(cacheLevel);
}
/** . */
@@ -78,7 +78,7 @@
//
if (invocation instanceof ResourceInvocation)
{
- url.parentCacheabilityType =
((ResourceInvocation)invocation).getContext().getCacheability();
+ url.parentCacheLevel =
((ResourceInvocation)invocation).getContext().getCacheability();
}
}
@@ -92,41 +92,41 @@
public String getCacheability()
{
- CacheabilityType cacheabilityType = url.getCacheability();
+ CacheLevel cacheLevel = url.getCacheability();
//
- return typetoJSR168.get(cacheabilityType);
+ return typetoJSR168.get(cacheLevel);
}
public void setCacheability(String s)
{
- CacheabilityType cacheabilityType = jsr168ToType.get(s);
+ CacheLevel cacheLevel = jsr168ToType.get(s);
//
- if (cacheabilityType != null)
+ if (cacheLevel != null)
{
- if (url.parentCacheabilityType == null)
+ if (url.parentCacheLevel == null)
{
- url.cacheabilityType = cacheabilityType;
+ url.cacheLevel = cacheLevel;
}
else
{
- switch (url.parentCacheabilityType)
+ switch (url.parentCacheLevel)
{
case FULL:
- if (cacheabilityType != CacheabilityType.FULL)
+ if (cacheLevel != CacheLevel.FULL)
{
throw new IllegalStateException();
}
break;
case PORTLET:
- if (cacheabilityType == CacheabilityType.PAGE)
+ if (cacheLevel == CacheLevel.PAGE)
{
throw new IllegalStateException();
}
break;
}
- url.cacheabilityType = cacheabilityType;
+ url.cacheLevel = cacheLevel;
}
}
}
@@ -143,10 +143,10 @@
private String id;
/** The cacheability constraining the url cacheability. */
- private CacheabilityType parentCacheabilityType;
+ private CacheLevel parentCacheLevel;
/** . */
- private CacheabilityType cacheabilityType;
+ private CacheLevel cacheLevel;
/** . */
private ParametersStateString parameters;
@@ -181,21 +181,21 @@
return id;
}
- public CacheabilityType getCacheability()
+ public CacheLevel getCacheability()
{
- if (cacheabilityType != null)
+ if (cacheLevel != null)
{
- return cacheabilityType;
+ return cacheLevel;
}
else
{
- if (parentCacheabilityType != null)
+ if (parentCacheLevel != null)
{
- return parentCacheabilityType;
+ return parentCacheLevel;
}
else
{
- return CacheabilityType.PAGE;
+ return CacheLevel.PAGE;
}
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -27,7 +27,7 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.spi.ResourceInvocationContext;
/**
@@ -41,7 +41,7 @@
private final String resourceId;
/** . */
- private final CacheabilityType cacheabilityType;
+ private final CacheLevel cacheLevel;
/** . */
private final StateString resourceState;
@@ -51,7 +51,7 @@
public AbstractResourceContext(
String resourceId,
- CacheabilityType cacheabilityType,
+ CacheLevel cacheLevel,
Mode mode,
WindowState windowState,
StateString navigationalState,
@@ -64,7 +64,7 @@
//
this.resourceId = resourceId;
- this.cacheabilityType = cacheabilityType;
+ this.cacheLevel = cacheLevel;
this.resourceState = resourceState;
this.form = form;
}
@@ -74,9 +74,9 @@
return resourceId;
}
- public CacheabilityType getCacheability()
+ public CacheLevel getCacheability()
{
- return cacheabilityType;
+ return cacheLevel;
}
public StateString getResourceState()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation.response;
+import org.jboss.portal.portlet.cache.CacheControl;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -65,8 +67,8 @@
/** The title if any. */
private String title;
- /** Number of seconds this result remains valid, a value of -1 indicates that it never
expires. */
- protected int expirationSecs;
+ /** . */
+ private CacheControl cacheControl;
public FragmentResponse()
{
@@ -75,7 +77,7 @@
this.writer = null;
this.contentType = null;
this.title = null;
- this.expirationSecs = 0;
+ this.cacheControl = null;
this.properties = null;
}
@@ -89,6 +91,16 @@
this.properties = properties;
}
+ public CacheControl getCacheControl()
+ {
+ return cacheControl;
+ }
+
+ public void setCacheControl(CacheControl cacheControl)
+ {
+ this.cacheControl = cacheControl;
+ }
+
public int getType()
{
if (bytes == null)
@@ -245,16 +257,6 @@
}
}
- public int getExpirationSecs()
- {
- return expirationSecs;
- }
-
- public void setExpirationSecs(int expirationSecs)
- {
- this.expirationSecs = expirationSecs;
- }
-
private class ClosableOutputStream extends OutputStream
{
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RevalidateMarkupResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RevalidateMarkupResponse.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/RevalidateMarkupResponse.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.invocation.response;
+
+import org.jboss.portal.portlet.cache.CacheControl;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RevalidateMarkupResponse extends PortletInvocationResponse
+{
+
+ /** . */
+ private final CacheControl cacheControl;
+
+ public RevalidateMarkupResponse(CacheControl cacheControl)
+ {
+ if (cacheControl == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.cacheControl = cacheControl;
+ }
+
+ public CacheControl getCacheControl()
+ {
+ return cacheControl;
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -29,7 +29,6 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.CacheabilityType;
/**
* Contract that defines what input/services the caller of a portlet container must
provide.
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.spi;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.common.util.ParameterMap;
/**
@@ -45,7 +45,7 @@
*
* @return the cacheability
*/
- CacheabilityType getCacheability();
+ CacheLevel getCacheability();
/**
* Returns the resource state of the request.
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -25,7 +25,7 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.spi.ResourceInvocationContext;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.EventInfo;
@@ -199,7 +199,7 @@
PageNavigationalState pageNS = null;
ParameterMap publicNS = null;
StateString portletNS = null;
- CacheabilityType cacheability;
+ CacheLevel cacheability;
//
if (portletResourceRequest instanceof PortletScopedPortletResourceRequest)
@@ -214,7 +214,7 @@
{
PageScopedFullPortletResourceRequest pageScopedRequest =
(PageScopedFullPortletResourceRequest)portletResourceRequest;
pageNS = pageScopedRequest.pageState;
- cacheability = CacheabilityType.PAGE;
+ cacheability = CacheLevel.PAGE;
//
if (pageNS != null)
@@ -224,12 +224,12 @@
}
else
{
- cacheability = CacheabilityType.PORTLET;
+ cacheability = CacheLevel.PORTLET;
}
}
else
{
- cacheability = CacheabilityType.FULL;
+ cacheability = CacheLevel.FULL;
}
//
@@ -893,13 +893,13 @@
{
/** . */
- private static final Map<Class, CacheabilityType> cacheability = new
HashMap<Class, CacheabilityType>();
+ private static final Map<Class, CacheLevel> cacheability = new
HashMap<Class, CacheLevel>();
static
{
- cacheability.put(FullScopedCacheablePortletResourceRequest.class,
CacheabilityType.FULL);
- cacheability.put(PortletScopedPortletResourceRequest.class,
CacheabilityType.PORTLET);
- cacheability.put(PageScopedFullPortletResourceRequest.class,
CacheabilityType.PAGE);
+ cacheability.put(FullScopedCacheablePortletResourceRequest.class,
CacheLevel.FULL);
+ cacheability.put(PortletScopedPortletResourceRequest.class,
CacheLevel.PORTLET);
+ cacheability.put(PageScopedFullPortletResourceRequest.class, CacheLevel.PAGE);
}
/** . */
@@ -927,7 +927,7 @@
this.bodyParameters = bodyParameters;
}
- public CacheabilityType getCacheabilityType()
+ public CacheLevel getCacheabilityType()
{
return cacheability.get(getClass());
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -33,7 +33,7 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.web.Body;
@@ -149,10 +149,10 @@
}
//
- CacheabilityType resourceCacheabilityType =
CacheabilityType.valueOf(req.getParameter(RESOURCE_CACHEABILITY));
+ CacheLevel resourceCacheLevel =
CacheLevel.valueOf(req.getParameter(RESOURCE_CACHEABILITY));
//
- switch (resourceCacheabilityType)
+ switch (resourceCacheLevel)
{
case FULL:
request = new
PortletController.FullScopedCacheablePortletResourceRequest(
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletURLRenderer.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -29,7 +29,7 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ResourceURL;
import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.common.text.CharBuffer;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.Tools;
@@ -203,11 +203,11 @@
}
//
- CacheabilityType cacheability = resourceURL.getCacheability();
+ CacheLevel cacheability = resourceURL.getCacheability();
parameters.put(RESOURCE_CACHEABILITY, cacheability.name());
//
- if (cacheability != CacheabilityType.FULL)
+ if (cacheability != CacheLevel.FULL)
{
if (windowNS != null)
{
@@ -224,7 +224,7 @@
parameters.put(WINDOW_STATE, windowNS.getWindowState().toString());
//
- if (cacheability == CacheabilityType.PAGE)
+ if (cacheability == CacheLevel.PAGE)
{
parameters.put(PAGE_STATE, pageState);
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java 2008-01-25
13:30:29 UTC (rev 9606)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java 2008-01-25
15:55:50 UTC (rev 9607)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.CacheabilityType;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.impl.spi.AbstractResourceContext;
import org.jboss.portal.Mode;
@@ -49,7 +49,7 @@
public ResourceTestContext(
String resourceId,
- CacheabilityType resourceCacheabilityType,
+ CacheLevel resourceCacheLevel,
PortletURLRenderer urlRenderer,
Mode mode,
WindowState windowState,
@@ -61,7 +61,7 @@
{
super(
resourceId,
- resourceCacheabilityType,
+ resourceCacheLevel,
mode,
windowState,
navigationalState,