Author: julien(a)jboss.com
Date: 2008-02-28 07:28:42 -0500 (Thu, 28 Feb 2008)
New Revision: 10152
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ContentResponse.java
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/impl/jsr168/api/MimeResponseImpl.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/invocation/response/FragmentResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/ContentRef.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/SoftContentRef.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/StrongContentRef.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponseRendererFactory.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/HeadersTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
Log:
introduced ContentResponse super class of FragmentResponse that is used by resource
response
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-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -27,9 +27,9 @@
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.cache.ContentRef;
import org.jboss.portal.portlet.invocation.response.cache.StrongContentRef;
-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.invocation.response.ContentResponse;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.cache.CacheControl;
@@ -144,7 +144,7 @@
}
}
- FragmentResponse fragment = cachedEntry != null ?
cachedEntry.contentRef.getContent() : null;
+ ContentResponse fragment = cachedEntry != null ?
cachedEntry.contentRef.getContent() : null;
// If no valid fragment we must invoke
if (fragment == null || cachedEntry.expirationTimeMillis <
System.currentTimeMillis())
@@ -160,9 +160,9 @@
// Try to cache any fragment result
CacheControl control = null;
- if (response instanceof FragmentResponse)
+ if (response instanceof ContentResponse)
{
- fragment = (FragmentResponse)response;
+ fragment = (ContentResponse)response;
control = fragment.getCacheControl();
}
else if (response instanceof RevalidateMarkupResponse)
@@ -261,7 +261,7 @@
ParameterMap publicNavigationalState,
WindowState windowState,
Mode mode,
- FragmentResponse content,
+ ContentResponse content,
long expirationTimeMillis,
String validationToken)
{
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-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -23,14 +23,14 @@
package org.jboss.portal.portlet.impl.jsr168.api;
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.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
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.portlet.impl.jsr168.ContentBuffer;
-import org.jboss.portal.Mode;
import javax.portlet.MimeResponse;
import javax.portlet.PortletURL;
@@ -40,7 +40,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.Locale;
-import java.util.Set;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -58,14 +58,9 @@
/** . */
private boolean contentTypeSet;
- /** The title if any. */
- protected String responseTitle;
-
/** . */
private ContentBuffer responseContent;
- /** . */
- protected Set<Mode> responseNextModes;
public MimeResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
@@ -84,10 +79,17 @@
this.bufferSize = 0;
this.contentTypeSet = false;
this.responseContent = new ContentBuffer();
- this.responseTitle = null;
- this.responseNextModes = null;
}
+ protected abstract ContentResponse createMarkupResponse(
+ ResponseProperties properties,
+ Map<String, Object> attributeMap,
+ String contentType,
+ byte[] bytes,
+ String chars,
+ org.jboss.portal.portlet.cache.CacheControl cacheControl
+ );
+
public PortletInvocationResponse getResponse()
{
org.jboss.portal.portlet.cache.CacheControl cc;
@@ -112,15 +114,13 @@
}
else
{
- return new FragmentResponse(
+ return createMarkupResponse(
getProperties(false),
preq.attributes.getAttributeMap(),
responseContent.getContentType(),
responseContent.getBytes(),
responseContent.getChars(),
- responseTitle,
- cc,
- responseNextModes != null ? responseNextModes : preq.supportedModes);
+ cc);
}
}
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-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -23,11 +23,13 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
import org.jboss.portal.portlet.info.ModeInfo;
+import org.jboss.portal.portlet.cache.CacheControl;
import org.jboss.portal.Mode;
import org.jboss.portal.common.util.MediaType;
@@ -37,6 +39,7 @@
import java.util.Collection;
import java.util.Set;
import java.util.LinkedHashSet;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -45,9 +48,19 @@
public class RenderResponseImpl extends MimeResponseImpl implements RenderResponse
{
+ /** . */
+ protected Set<Mode> responseNextModes;
+
+ /** The title if any. */
+ protected String responseTitle;
+
public RenderResponseImpl(RenderInvocation invocation, PortletRequestImpl preq)
{
super(invocation, preq);
+
+ //
+ this.responseNextModes = null;
+ this.responseTitle = null;
}
public void setTitle(String title)
@@ -142,4 +155,17 @@
throw ex;
}
}
+
+ protected ContentResponse createMarkupResponse(ResponseProperties properties,
Map<String, Object> attributeMap, String contentType, byte[] bytes, String chars,
CacheControl cacheControl)
+ {
+ return new FragmentResponse(
+ properties,
+ attributeMap,
+ contentType,
+ bytes,
+ chars,
+ responseTitle,
+ cacheControl,
+ responseNextModes != null ? responseNextModes : preq.supportedModes);
+ }
}
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-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -23,11 +23,15 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.portlet.cache.CacheControl;
import javax.portlet.ResourceResponse;
import javax.portlet.PortletURL;
import java.util.Locale;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -85,4 +89,15 @@
//
return super.createRenderURL();
}
+
+ protected ContentResponse createMarkupResponse(ResponseProperties properties,
Map<String, Object> attributeMap, String contentType, byte[] bytes, String chars,
CacheControl cacheControl)
+ {
+ return new ContentResponse(
+ properties,
+ attributeMap,
+ contentType,
+ bytes,
+ chars,
+ cacheControl);
+ }
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ContentResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ContentResponse.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/ContentResponse.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -0,0 +1,168 @@
+/******************************************************************************
+ * 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;
+import org.jboss.portal.Mode;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * Data produced.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5602 $
+ */
+public class ContentResponse extends PortletInvocationResponse
+{
+
+ /** . */
+ public static final int TYPE_EMPTY = 0;
+
+ /** . */
+ public static final int TYPE_CHARS = 1;
+
+ /** . */
+ public static final int TYPE_BYTES = 2;
+
+ /** . */
+ private final ResponseProperties properties;
+
+ /** . */
+ private final Map<String, Object> attributes;
+
+ /** The result content type if any. */
+ private String contentType;
+
+ /** . */
+ private final byte[] bytes;
+
+ /** . */
+ private final String chars;
+
+ /** . */
+ private final CacheControl cacheControl;
+
+ public ContentResponse(
+ ResponseProperties properties,
+ Map<String, Object> attributes,
+ String contentType,
+ byte[] bytes,
+ String chars,
+ CacheControl cacheControl)
+ {
+ this.properties = properties;
+ this.attributes = attributes;
+ this.contentType = contentType;
+ this.bytes = bytes;
+ this.chars = chars;
+ this.cacheControl = cacheControl;
+ }
+
+ public ResponseProperties getProperties()
+ {
+ return properties;
+ }
+
+ public CacheControl getCacheControl()
+ {
+ return cacheControl;
+ }
+
+ public Map<String, Object> getAttributes()
+ {
+ return attributes;
+ }
+
+ public int getType()
+ {
+ if (bytes == null)
+ {
+ if (chars == null)
+ {
+ return TYPE_EMPTY;
+ }
+ else
+ {
+ return TYPE_CHARS;
+ }
+ }
+ else
+ {
+ return TYPE_BYTES;
+ }
+ }
+
+ /**
+ * Return the content as a string.
+ *
+ * @return the content
+ */
+ public String getContent()
+ {
+ switch (getType())
+ {
+ case TYPE_CHARS:
+ return getChars();
+ case TYPE_BYTES:
+ return new String(bytes);
+ case TYPE_EMPTY:
+ return "";
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ /**
+ * Return the bytes of the content held by the fragment.
+ *
+ * @return the bytes
+ * @throws IllegalArgumentException if the type is not bytes
+ */
+ public byte[] getBytes() throws IllegalArgumentException
+ {
+ return bytes;
+ }
+
+ /**
+ * Return the chars of the content held by the fragment.
+ *
+ * @return the chars
+ * @throws IllegalArgumentException if the type is not chars
+ */
+ public String getChars() throws IllegalArgumentException
+ {
+ return chars;
+ }
+
+ /**
+ * Return the content type of the generated fragment.
+ *
+ * @return the content type
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+}
\ No newline at end of file
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-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -34,40 +34,13 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5602 $
*/
-public class FragmentResponse extends PortletInvocationResponse
+public class FragmentResponse extends ContentResponse
{
- /** . */
- public static final int TYPE_EMPTY = 0;
-
- /** . */
- public static final int TYPE_CHARS = 1;
-
- /** . */
- public static final int TYPE_BYTES = 2;
-
- /** . */
- private final ResponseProperties properties;
-
- /** . */
- private final Map<String, Object> attributes;
-
- /** The result content type if any. */
- private String contentType;
-
- /** . */
- private final byte[] bytes;
-
- /** . */
- private final String chars;
-
/** The title if any. */
private final String title;
- /** . */
- private final CacheControl cacheControl;
-
- /** . */
+ /** The next modes. */
private final Set<Mode> nextModes;
public FragmentResponse(
@@ -80,93 +53,14 @@
CacheControl cacheControl,
Set<Mode> nextModes)
{
- this.properties = properties;
- this.attributes = attributes;
- this.contentType = contentType;
- this.bytes = bytes;
- this.chars = chars;
+ super(properties, attributes, contentType, bytes, chars, cacheControl);
+
+ //
this.title = title;
- this.cacheControl = cacheControl;
this.nextModes = nextModes;
}
- public ResponseProperties getProperties()
- {
- return properties;
- }
-
- public CacheControl getCacheControl()
- {
- return cacheControl;
- }
-
- public Map<String, Object> getAttributes()
- {
- return attributes;
- }
-
- public int getType()
- {
- if (bytes == null)
- {
- if (chars == null)
- {
- return TYPE_EMPTY;
- }
- else
- {
- return TYPE_CHARS;
- }
- }
- else
- {
- return TYPE_BYTES;
- }
- }
-
/**
- * Return the content as a string.
- *
- * @return the content
- */
- public String getContent()
- {
- switch (getType())
- {
- case TYPE_CHARS:
- return getChars();
- case TYPE_BYTES:
- return new String(bytes);
- case TYPE_EMPTY:
- return "";
- default:
- throw new AssertionError();
- }
- }
-
- /**
- * Return the bytes of the content held by the fragment.
- *
- * @return the bytes
- * @throws IllegalArgumentException if the type is not bytes
- */
- public byte[] getBytes() throws IllegalArgumentException
- {
- return bytes;
- }
-
- /**
- * Return the chars of the content held by the fragment.
- *
- * @return the chars
- * @throws IllegalArgumentException if the type is not chars
- */
- public String getChars() throws IllegalArgumentException
- {
- return chars;
- }
-
- /**
* Return the fragment title.
*
* @return the title.
@@ -177,15 +71,10 @@
}
/**
- * Return the content type of the generated fragment.
+ * Returns the next modes.
*
- * @return the content type
+ * @return the next modes
*/
- public String getContentType()
- {
- return contentType;
- }
-
public Set<Mode> getNextModes()
{
return nextModes;
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/ContentRef.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/ContentRef.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/ContentRef.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation.response.cache;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import java.io.Serializable;
@@ -40,5 +40,5 @@
*
* @return the content
*/
- public abstract FragmentResponse getContent();
+ public abstract ContentResponse getContent();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/SoftContentRef.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/SoftContentRef.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/SoftContentRef.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation.response.cache;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import java.lang.ref.WeakReference;
@@ -39,22 +39,22 @@
private static final long serialVersionUID = -8166044526732362286L;
/** The content. */
- private transient WeakReference<FragmentResponse> content;
+ private transient WeakReference<ContentResponse> content;
/**
* @param content the content
* @throws IllegalArgumentException if the content is null
*/
- public SoftContentRef(FragmentResponse content) throws IllegalArgumentException
+ public SoftContentRef(ContentResponse content) throws IllegalArgumentException
{
if (content == null)
{
throw new IllegalArgumentException("Content must not be null");
}
- this.content = new WeakReference<FragmentResponse>(content);
+ this.content = new WeakReference<ContentResponse>(content);
}
- public FragmentResponse getContent()
+ public ContentResponse getContent()
{
return content.get();
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/StrongContentRef.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/StrongContentRef.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/cache/StrongContentRef.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation.response.cache;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
/**
* Use strong references.
@@ -37,13 +37,13 @@
private static final long serialVersionUID = -8194245397756941208L;
/** The content. */
- private transient FragmentResponse content;
+ private transient ContentResponse content;
/**
* @param content the content
* @throws IllegalArgumentException if the content is null
*/
- public StrongContentRef(FragmentResponse content) throws IllegalArgumentException
+ public StrongContentRef(ContentResponse content) throws IllegalArgumentException
{
if (content == null)
{
@@ -52,7 +52,7 @@
this.content = content;
}
- public FragmentResponse getContent()
+ public ContentResponse getContent()
{
return content;
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponseRendererFactory.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponseRendererFactory.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ControllerResponseRendererFactory.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -30,10 +30,10 @@
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -84,9 +84,9 @@
ResourceResponse resourceResponse = (ResourceResponse)response;
//
- if (resourceResponse.getResponse() instanceof FragmentResponse)
+ if (resourceResponse.getResponse() instanceof ContentResponse)
{
- return new ResourceRenderer((FragmentResponse)resourceResponse.getResponse(),
sendNoContentResponseOnEmptyResource);
+ return new ResourceRenderer((ContentResponse)resourceResponse.getResponse(),
sendNoContentResponseOnEmptyResource);
}
else
{
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/FragmentRenderer.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -24,7 +24,7 @@
package org.jboss.portal.portlet.test.controller;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -32,7 +32,7 @@
*/
public interface FragmentRenderer
{
- String renderPortlet(FragmentResponse fragment);
+ String renderPortlet(ContentResponse fragment);
String renderError(ErrorResponse error);
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -39,9 +39,9 @@
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-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.invocation.response.ContentResponse;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.w3c.dom.Element;
@@ -62,7 +62,7 @@
{
protected FragmentRenderer fragmentRenderer = new SimpleFragmentRenderer();
- protected List<FragmentResponse> fragments;
+ protected List<ContentResponse> fragments;
protected List<ErrorResponse> errors;
protected PageNavigationalState pageNavigationalState;
@@ -110,7 +110,7 @@
writer.print("<body>");
- for (FragmentResponse fragment : fragments)
+ for (ContentResponse fragment : fragments)
{
writer.print(fragmentRenderer.renderPortlet(fragment));
@@ -136,7 +136,7 @@
Collection<Portlet> portlets = context.getPortlets();
int capacity = portlets.size();
- fragments = new ArrayList<FragmentResponse>(capacity);
+ fragments = new ArrayList<ContentResponse>(capacity);
errors = new ArrayList<ErrorResponse>(capacity);
for (Portlet portlet : portlets)
@@ -175,9 +175,9 @@
{
PortletInvocationResponse response = context.render(render);
- if (response instanceof FragmentResponse)
+ if (response instanceof ContentResponse)
{
- FragmentResponse fragment = (FragmentResponse)response;
+ ContentResponse fragment = (ContentResponse)response;
//
fragments.add(fragment);
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceRenderer.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ResourceRenderer.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -24,7 +24,7 @@
package org.jboss.portal.portlet.test.controller;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -39,12 +39,12 @@
{
/** . */
- private FragmentResponse fragment;
+ private ContentResponse fragment;
/** . */
private boolean sendNoContentResponseOnEmptyResource;
- public ResourceRenderer(FragmentResponse response, boolean
sendNoContentResponseOnEmptyResource)
+ public ResourceRenderer(ContentResponse response, boolean
sendNoContentResponseOnEmptyResource)
{
super(response.getProperties());
@@ -55,7 +55,7 @@
protected void renderContent(HttpServletResponse resp) throws IOException
{
- if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
+ if (fragment.getType() == ContentResponse.TYPE_EMPTY)
{
if (sendNoContentResponseOnEmptyResource)
{
@@ -90,7 +90,7 @@
}
//
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ if (fragment.getType() == ContentResponse.TYPE_BYTES)
{
ServletOutputStream out = null;
try
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/SimpleFragmentRenderer.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -24,7 +24,7 @@
package org.jboss.portal.portlet.test.controller;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import java.io.UnsupportedEncodingException;
@@ -34,15 +34,15 @@
*/
public class SimpleFragmentRenderer implements FragmentRenderer
{
- public String renderPortlet(FragmentResponse fragment)
+ public String renderPortlet(ContentResponse fragment)
{
- if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
+ if (fragment.getType() != ContentResponse.TYPE_EMPTY)
{
String frag;
//
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ if (fragment.getType() == ContentResponse.TYPE_BYTES)
{
try
{
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -28,8 +28,8 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
@@ -161,31 +161,31 @@
PortletInvocationResponse pir = resourceResponse.getResponse();
//
- if (pir instanceof FragmentResponse)
+ if (pir instanceof ContentResponse)
{
- FragmentResponse fragment = (FragmentResponse)pir;
+ ContentResponse contentResponse = (ContentResponse)pir;
//
- if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
+ if (contentResponse.getType() == ContentResponse.TYPE_EMPTY)
{
resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
}
else
{
- String contentType = fragment.getContentType();
+ String contentType = contentResponse.getContentType();
if (contentType != null)
{
resp.setContentType(contentType);
}
//
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ if (contentResponse.getType() == ContentResponse.TYPE_BYTES)
{
ServletOutputStream out = null;
try
{
out = resp.getOutputStream();
- out.write(fragment.getBytes());
+ out.write(contentResponse.getBytes());
}
finally
{
@@ -198,7 +198,7 @@
try
{
writer = resp.getWriter();
- writer.write(fragment.getChars());
+ writer.write(contentResponse.getChars());
}
finally
{
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/HeadersTag.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/HeadersTag.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/HeadersTag.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -26,8 +26,8 @@
import org.jboss.portal.portlet.test.jsp.WindowResult;
import org.jboss.portal.portlet.test.jsp.PortalPrepareResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.common.util.MultiValuedPropertyMap;
import org.jboss.portal.common.xml.XMLTools;
import org.w3c.dom.Element;
@@ -69,9 +69,9 @@
PortletInvocationResponse response = result.getResponse();
//
- if (response instanceof FragmentResponse)
+ if (response instanceof ContentResponse)
{
- FragmentResponse fragmentResponse = (FragmentResponse)response;
+ ContentResponse fragmentResponse = (ContentResponse)response;
//
ResponseProperties properties = fragmentResponse.getProperties();
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.WindowState;
@@ -49,9 +49,9 @@
if (portletResp != null)
{
- if (portletResp instanceof FragmentResponse)
+ if (portletResp instanceof ContentResponse)
{
- FragmentResponse fragment = (FragmentResponse)portletResp;
+ ContentResponse fragment = (ContentResponse)portletResp;
WindowNavigationalState windowNS = null;
if (renderResponse.getPageNavigationalState() != null)
{
@@ -59,16 +59,16 @@
}
if (windowNS == null ||
!windowNS.getWindowState().equals(WindowState.MINIMIZED))
{
- if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
+ if (fragment.getType() != ContentResponse.TYPE_EMPTY)
{
String frag;
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ if (fragment.getType() == ContentResponse.TYPE_BYTES)
{
frag = fragment.getBytes().toString();
}
else
{
- frag = fragment.getChars().toString();
+ frag = fragment.getChars();
}
out.write(frag);
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-28
11:57:23 UTC (rev 10151)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-28
12:28:42 UTC (rev 10152)
@@ -28,9 +28,9 @@
import org.jboss.portal.portlet.test.jsp.WindowDef;
import org.jboss.portal.portlet.test.jsp.WindowResult;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.Tools;
@@ -278,7 +278,7 @@
PortletInvocationResponse portletResponse = result.getResponse();
//
- if (portletResponse instanceof FragmentResponse)
+ if (portletResponse instanceof ContentResponse)
{
this.result = result;
//