Author: thomas.heute(a)jboss.com
Date: 2009-09-17 06:37:38 -0400 (Thu, 17 Sep 2009)
New Revision: 193
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/MimeResponseImpl.java
Log:
Content type can be set several times. (Can also be used to set the character encoding in
resource serving)
Modified:
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/MimeResponseImpl.java
===================================================================
---
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/MimeResponseImpl.java 2009-09-14
14:06:04 UTC (rev 192)
+++
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/MimeResponseImpl.java 2009-09-17
10:37:38 UTC (rev 193)
@@ -61,7 +61,10 @@
/** . */
private ContentBuffer responseContent;
+ /** . */
+ private boolean canSetContentType;
+
public MimeResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
super(invocation, preq);
@@ -72,6 +75,7 @@
// 0 means no buffering - we say no buffering
this.bufferSize = 0;
this.contentTypeSet = false;
+ this.canSetContentType = true;
this.responseContent = new ContentBuffer();
}
@@ -125,7 +129,7 @@
public void setContentType(String contentType)
{
- if (responseContent.getContentType() == null)
+ if (canSetContentType)
{
responseContent.setContentType(contentType);
contentTypeSet = true;
@@ -134,6 +138,7 @@
public PrintWriter getWriter() throws IOException
{
+ canSetContentType = false;
if (responseContent.getContentType() == null)
{
responseContent.setContentType(preq.getResponseContentType());
@@ -145,6 +150,7 @@
public OutputStream getPortletOutputStream() throws IOException
{
+ canSetContentType = false;
if (responseContent.getContentType() == null)
{
responseContent.setContentType(preq.getResponseContentType());
Show replies by date