From: markt Date: Thu, 20 May 2010 09:49:24 +0000 (+0000) Subject: Fix lost session path parameter on redirect X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=d0ca6b1fc6edc2b02a54ee7e816ef6b8bc8293c7;p=tomcat7.0 Fix lost session path parameter on redirect git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@946584 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java index 2320c83dc..0e99df6b5 100644 --- a/java/org/apache/catalina/connector/CoyoteAdapter.java +++ b/java/org/apache/catalina/connector/CoyoteAdapter.java @@ -588,6 +588,22 @@ public class CoyoteAdapter implements Adapter { return false; } + // Now we have the context, we can parse the session ID from the URL + // (if any). Need to do this before we redirect in case we need to + // include the session id in the redirect + if (request.getServletContext().getEffectiveSessionTrackingModes() + .contains(SessionTrackingMode.URL)) { + + // Get the session ID if there was one + String sessionID = request.getPathParameter( + ApplicationSessionCookieConfig.getSessionUriParamName( + request.getContext())); + if (sessionID != null) { + request.setRequestedSessionId(sessionID); + request.setRequestedSessionURL(true); + } + } + // Possible redirect MessageBytes redirectPathMB = request.getMappingData().redirectPath; if (!redirectPathMB.isNull()) { @@ -610,19 +626,7 @@ public class CoyoteAdapter implements Adapter { return false; } - // Parse session Id - if (request.getServletContext().getEffectiveSessionTrackingModes() - .contains(SessionTrackingMode.URL)) { - - // Get the session ID if there was one - String sessionID = request.getPathParameter( - ApplicationSessionCookieConfig.getSessionUriParamName( - request.getContext())); - if (sessionID != null) { - request.setRequestedSessionId(sessionID); - request.setRequestedSessionURL(true); - } - } + // Finally look for session ID in cookies and SSL session parseSessionCookiesId(req, request); parseSessionSslId(request); return true;