Author: remy.maucherat(a)jboss.com
Date: 2008-01-03 05:43:08 -0500 (Thu, 03 Jan 2008)
New Revision: 386
Modified:
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
Log:
- Redirect for / uses URL encoding.
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2008-01-02 10:32:36 UTC
(rev 385)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2008-01-03 10:43:08 UTC
(rev 386)
@@ -24,6 +24,7 @@
import org.apache.catalina.Globals;
import org.apache.catalina.Wrapper;
import org.apache.catalina.util.StringManager;
+import org.apache.catalina.util.URLEncoder;
import org.apache.comet.CometEvent;
import org.apache.coyote.ActionCode;
import org.apache.coyote.Adapter;
@@ -100,6 +101,28 @@
StringManager.getManager(Constants.Package);
+ /**
+ * Encoder for the Location URL in HTTP redirects.
+ */
+ protected static URLEncoder urlEncoder;
+
+
+ // ----------------------------------------------------- Static Initializer
+
+
+ /**
+ * The safe character set.
+ */
+ static {
+ urlEncoder = new URLEncoder();
+ urlEncoder.addSafeCharacter('-');
+ urlEncoder.addSafeCharacter('_');
+ urlEncoder.addSafeCharacter('.');
+ urlEncoder.addSafeCharacter('*');
+ urlEncoder.addSafeCharacter('/');
+ }
+
+
// -------------------------------------------------------- Adapter Methods
@@ -484,7 +507,7 @@
// Possible redirect
MessageBytes redirectPathMB = request.getMappingData().redirectPath;
if (!redirectPathMB.isNull()) {
- String redirectPath = redirectPathMB.toString();
+ String redirectPath = urlEncoder.encode(redirectPathMB.toString());
String query = request.getQueryString();
if (request.isRequestedSessionIdFromURL()) {
// This is not optimal, but as this is not very common, it
Show replies by date