Author: mwringe
Date: 2010-03-19 11:53:10 -0400 (Fri, 19 Mar 2010)
New Revision: 2315
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-19
15:50:46 UTC (rev 2314)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-03-19
15:53:10 UTC (rev 2315)
@@ -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 = "/";
}