You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by es...@apache.org on 2008/03/02 19:24:26 UTC

svn commit: r632806 - in /portals/pluto/trunk: pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java pluto-site/src/site/fml/faq.fml

Author: esm
Date: Sun Mar  2 10:24:19 2008
New Revision: 632806

URL: http://svn.apache.org/viewvc?rev=632806&view=rev
Log:
[PLUTO-446]: added init-param to PortalDriverServlet to set the response charset.  Modified the patch from miceuz.  Thanks miceuz! (merged from pluto-1.1.x branch r632790)

Modified:
    portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
    portals/pluto/trunk/pluto-site/src/site/fml/faq.fml

Modified: portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java?rev=632806&r1=632805&r2=632806&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java (original)
+++ portals/pluto/trunk/pluto-portal-driver/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java Sun Mar  2 10:24:19 2008
@@ -38,6 +38,7 @@
 import org.apache.pluto.driver.services.portal.PageConfig;
 import org.apache.pluto.driver.services.portal.PortletWindowConfig;
 import org.apache.pluto.driver.url.PortalURL;
+
 /**
  * The controller servlet used to drive the Portal Driver. All requests mapped
  * to this servlet will be processed as Portal Requests.
@@ -61,10 +62,11 @@
     
     /** The portlet container to which we will forward all portlet requests. */
     protected PortletContainer container = null;
-    
-    
-    
-    
+
+    /** Character encoding and content type of the response */
+    private String contentType = "";
+
+
     // HttpServlet Impl --------------------------------------------------------
     
     public String getServletInfo() {
@@ -80,6 +82,11 @@
         servletContext = getServletContext();
         container = (PortletContainer) servletContext.getAttribute(
         		AttributeKeys.PORTLET_CONTAINER);        
+        String charset = getServletConfig().getInitParameter("charset");
+        if (charset != null && charset.length() > 0) {
+            contentType = "text/html; charset=" + charset;
+        }
+
     }
     
 
@@ -92,6 +99,10 @@
      */
     public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
+
+        if ( contentType != "" ) {
+            response.setContentType( contentType );
+        }
 
         PortalRequestContext portalRequestContext =
             new PortalRequestContext(getServletContext(), request, response);

Modified: portals/pluto/trunk/pluto-site/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-site/src/site/fml/faq.fml?rev=632806&r1=632805&r2=632806&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-site/src/site/fml/faq.fml (original)
+++ portals/pluto/trunk/pluto-site/src/site/fml/faq.fml Sun Mar  2 10:24:19 2008
@@ -136,5 +136,25 @@
       </answer>
     </faq>
 
+    <faq id="encoding">
+        <question>How can I change the default encoding of the Pluto Portal</question>
+        <answer>
+            <p>As of Pluto 1.1.5 you can change the default encoding of the Pluto Portal by
+               editing the Pluto Portlet Servlet's web.xml.  Add an init-param with
+               the name of "charset" and set the value to the desired character set.</p>
+            <textarea style="border:0; width: 100%; background:transparent; color:#555555" rows="15" readonly="true">
+  <servlet>
+    <servlet-name>plutoPortalDriver</servlet-name>
+    <display-name>Pluto Portal Driver</display-name>
+    <description>Pluto Portal Driver Controller</description>
+    <servlet-class>org.apache.pluto.driver.PortalDriverServlet</servlet-class>
+    <init-param>
+      <param-name>charset</param-name>
+      <param-value>UTF-8</param-value>
+    </init-param>
+  </servlet>
+            </textarea>
+        </answer>
+    </faq>
   </part>
 </faqs>