Author: mwringe
Date: 2012-02-07 10:25:41 -0500 (Tue, 07 Feb 2012)
New Revision: 8411
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
Log:
JBEPP-1376: Update the way handle resources to not use ContentResponse.getContent as this
doesn't properly handle encoding.
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2012-02-06
21:01:34 UTC (rev 8410)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2012-02-07
15:25:41 UTC (rev 8411)
@@ -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
{
@@ -437,14 +438,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();