Author: mwringe
Date: 2012-02-03 14:04:07 -0500 (Fri, 03 Feb 2012)
New Revision: 8402
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
Log:
GTNPC-78: Change the way we handle resources so that we don't use
ContentResponse.getContent which doesn't handle string encoding properly.
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2012-02-03
17:31:55 UTC (rev 8401)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2012-02-03
19:04:07 UTC (rev 8402)
@@ -23,6 +23,21 @@
package org.exoplatform.portal.webui.application;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
import org.exoplatform.portal.Constants;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.webui.page.UIPage;
@@ -57,20 +72,6 @@
import org.gatein.pc.api.invocation.response.SecurityResponse;
import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
/** May 29, 2006 */
public class UIPortletActionListener
{
@@ -440,14 +441,14 @@
log.trace("Try to get a resource of type: " + contentType + "
for the portlet: "
+ uiPortlet.getPortletContext());
- if (piResponse.getChars() != null ||
contentType.startsWith("text"))
+ response.setContentType(contentType);
+ if (piResponse.getChars() != null)
{
- context.getResponse().setContentType(contentType);
- context.getWriter().write(piResponse.getContent());
+ OutputStream stream = response.getOutputStream();
+
stream.write(piResponse.getChars().getBytes(response.getCharacterEncoding()));
}
else
{
- response.setContentType(contentType);
if (piResponse.getBytes() != null)
{
OutputStream stream = response.getOutputStream();