[gatein-commits] gatein SVN: r2262 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 15 13:58:19 EDT 2010


Author: mwringe
Date: 2010-03-15 13:58:19 -0400 (Mon, 15 Mar 2010)
New Revision: 2262

Modified:
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
Log:
GTNPORTAL-596: get the pathInfo from getRequestURI and process the pathInfo from that directly. This will allow us to use UTF-8 encoding instead of relying on what the web container is setup to use.

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java	2010-03-15 12:23:29 UTC (rev 2261)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java	2010-03-15 17:58:19 UTC (rev 2262)
@@ -131,7 +131,7 @@
       
       
       //The encoding needs to be set before reading any of the parameters since the parameters's encoding
-      //is set at the first acces.
+      //is set at the first access.
       
       //TODO use the encoding from the locale-config.xml file
       response_.setContentType("text/html; charset=UTF-8");
@@ -152,8 +152,15 @@
       }
 
       requestURI_ = URLDecoder.decode(req.getRequestURI(), "UTF-8");
-      String pathInfo = req.getPathInfo();
-      if (pathInfo == null)
+      
+      // req.getPathInfo will already have the encoding set from the server.
+      // We need to use the UTF-8 value since this is how we store the portal name.
+      // Reconstructing the getPathInfo from the non server decoded values.
+      String servletPath = URLDecoder.decode(req.getServletPath(), "UTF-8");
+      String contextPath = URLDecoder.decode(req.getContextPath(), "UTF-8");
+      String pathInfo = requestURI_.substring((servletPath + contextPath).length());
+      
+      if (pathInfo == null || pathInfo.isEmpty())
       {
          pathInfo = "/";
       }



More information about the gatein-commits mailing list