You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/01/04 17:33:40 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardContextValve.java StandardHostValve.java
remm 02/01/04 08:33:40
Modified: catalina/src/share/org/apache/catalina/core
StandardContextValve.java StandardHostValve.java
Log:
- Fix for 5368: mark the session as accessed before going in the Context
pipeline (before, the session was marked as non-new only in the last useable
valve of the pipeline). This is not the proposed patch for this bug. Please confirm
it does fix the problem.
Revision Changes Path
1.15 +6 -17 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java
Index: StandardContextValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- StandardContextValve.java 5 Oct 2001 22:03:53 -0000 1.14
+++ StandardContextValve.java 4 Jan 2002 16:33:40 -0000 1.15
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v 1.14 2001/10/05 22:03:53 remm Exp $
- * $Revision: 1.14 $
- * $Date: 2001/10/05 22:03:53 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v 1.15 2002/01/04 16:33:40 remm Exp $
+ * $Revision: 1.15 $
+ * $Date: 2002/01/04 16:33:40 $
*
* ====================================================================
*
@@ -74,10 +74,9 @@
import org.apache.naming.ContextBindings;
import org.apache.naming.resources.DirContextURLStreamHandler;
import org.apache.catalina.Container;
-import org.apache.catalina.Manager;
+import org.apache.catalina.Context;
import org.apache.catalina.Request;
import org.apache.catalina.Response;
-import org.apache.catalina.Session;
import org.apache.catalina.ValveContext;
import org.apache.catalina.Wrapper;
import org.apache.catalina.util.RequestUtil;
@@ -93,7 +92,7 @@
* when processing HTTP requests.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.14 $ $Date: 2001/10/05 22:03:53 $
+ * @version $Revision: 1.15 $ $Date: 2002/01/04 16:33:40 $
*/
final class StandardContextValve
@@ -169,17 +168,7 @@
return;
}
- // Update the session last access time for our session (if any)
- StandardContext context = (StandardContext) getContainer();
- String sessionId = hreq.getRequestedSessionId();
- if (sessionId != null) {
- Manager manager = context.getManager();
- if (manager != null) {
- Session session = manager.findSession(sessionId);
- if ((session != null) && session.isValid())
- session.access();
- }
- }
+ Context context = (Context) getContainer();
// Select the Wrapper to be used for this Request
Wrapper wrapper = null;
1.6 +21 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java
Index: StandardHostValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- StandardHostValve.java 22 Jul 2001 20:25:08 -0000 1.5
+++ StandardHostValve.java 4 Jan 2002 16:33:40 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v 1.5 2001/07/22 20:25:08 pier Exp $
- * $Revision: 1.5 $
- * $Date: 2001/07/22 20:25:08 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v 1.6 2002/01/04 16:33:40 remm Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/01/04 16:33:40 $
*
* ====================================================================
*
@@ -71,8 +71,10 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
+import org.apache.catalina.Manager;
import org.apache.catalina.Request;
import org.apache.catalina.Response;
+import org.apache.catalina.Session;
import org.apache.catalina.ValveContext;
import org.apache.catalina.util.StringManager;
import org.apache.catalina.valves.ValveBase;
@@ -86,7 +88,7 @@
* when processing HTTP requests.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.5 $ $Date: 2001/07/22 20:25:08 $
+ * @version $Revision: 1.6 $ $Date: 2002/01/04 16:33:40 $
*/
final class StandardHostValve
@@ -158,9 +160,23 @@
return;
}
- // Ask this Context to process this request
+ // Bind the context CL to the current thread
Thread.currentThread().setContextClassLoader
(context.getLoader().getClassLoader());
+
+ // Update the session last access time for our session (if any)
+ HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
+ String sessionId = hreq.getRequestedSessionId();
+ if (sessionId != null) {
+ Manager manager = context.getManager();
+ if (manager != null) {
+ Session session = manager.findSession(sessionId);
+ if ((session != null) && session.isValid())
+ session.access();
+ }
+ }
+
+ // Ask this Context to process this request
context.invoke(request, response);
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardContextValve.java StandardHostValve.java
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Remy, I built today's HEAD and verified your fix (much cleaner than
what was previously proposed).
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5368
Please backport this bug fix to the 4.0.x branch.
Thanks, Dan
remm@apache.org writes:
> remm 02/01/04 08:33:40
>
> Modified: catalina/src/share/org/apache/catalina/core
> StandardContextValve.java StandardHostValve.java
> Log:
> - Fix for 5368: mark the session as accessed before going in the Context
> pipeline (before, the session was marked as non-new only in the last useable
> valve of the pipeline). This is not the proposed patch for this bug. Please confirm
> it does fix the problem.
>
> Revision Changes Path
> 1.15 +6 -17 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java
>
> Index: StandardContextValve.java
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v
> retrieving revision 1.14
> retrieving revision 1.15
> diff -u -r1.14 -r1.15
> --- StandardContextValve.java 5 Oct 2001 22:03:53 -0000 1.14
> +++ StandardContextValve.java 4 Jan 2002 16:33:40 -0000 1.15
> @@ -1,7 +1,7 @@
> /*
> - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v 1.14 2001/10/05 22:03:53 remm Exp $
> - * $Revision: 1.14 $
> - * $Date: 2001/10/05 22:03:53 $
> + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v 1.15 2002/01/04 16:33:40 remm Exp $
> + * $Revision: 1.15 $
> + * $Date: 2002/01/04 16:33:40 $
> *
> * ====================================================================
> *
> @@ -74,10 +74,9 @@
> import org.apache.naming.ContextBindings;
> import org.apache.naming.resources.DirContextURLStreamHandler;
> import org.apache.catalina.Container;
> -import org.apache.catalina.Manager;
> +import org.apache.catalina.Context;
> import org.apache.catalina.Request;
> import org.apache.catalina.Response;
> -import org.apache.catalina.Session;
> import org.apache.catalina.ValveContext;
> import org.apache.catalina.Wrapper;
> import org.apache.catalina.util.RequestUtil;
> @@ -93,7 +92,7 @@
> * when processing HTTP requests.
> *
> * @author Craig R. McClanahan
> - * @version $Revision: 1.14 $ $Date: 2001/10/05 22:03:53 $
> + * @version $Revision: 1.15 $ $Date: 2002/01/04 16:33:40 $
> */
>
> final class StandardContextValve
> @@ -169,17 +168,7 @@
> return;
> }
>
> - // Update the session last access time for our session (if any)
> - StandardContext context = (StandardContext) getContainer();
> - String sessionId = hreq.getRequestedSessionId();
> - if (sessionId != null) {
> - Manager manager = context.getManager();
> - if (manager != null) {
> - Session session = manager.findSession(sessionId);
> - if ((session != null) && session.isValid())
> - session.access();
> - }
> - }
> + Context context = (Context) getContainer();
>
> // Select the Wrapper to be used for this Request
> Wrapper wrapper = null;
>
>
>
> 1.6 +21 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java
>
> Index: StandardHostValve.java
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- StandardHostValve.java 22 Jul 2001 20:25:08 -0000 1.5
> +++ StandardHostValve.java 4 Jan 2002 16:33:40 -0000 1.6
> @@ -1,7 +1,7 @@
> /*
> - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v 1.5 2001/07/22 20:25:08 pier Exp $
> - * $Revision: 1.5 $
> - * $Date: 2001/07/22 20:25:08 $
> + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v 1.6 2002/01/04 16:33:40 remm Exp $
> + * $Revision: 1.6 $
> + * $Date: 2002/01/04 16:33:40 $
> *
> * ====================================================================
> *
> @@ -71,8 +71,10 @@
> import javax.servlet.http.HttpServletResponse;
> import org.apache.catalina.Container;
> import org.apache.catalina.Context;
> +import org.apache.catalina.Manager;
> import org.apache.catalina.Request;
> import org.apache.catalina.Response;
> +import org.apache.catalina.Session;
> import org.apache.catalina.ValveContext;
> import org.apache.catalina.util.StringManager;
> import org.apache.catalina.valves.ValveBase;
> @@ -86,7 +88,7 @@
> * when processing HTTP requests.
> *
> * @author Craig R. McClanahan
> - * @version $Revision: 1.5 $ $Date: 2001/07/22 20:25:08 $
> + * @version $Revision: 1.6 $ $Date: 2002/01/04 16:33:40 $
> */
>
> final class StandardHostValve
> @@ -158,9 +160,23 @@
> return;
> }
>
> - // Ask this Context to process this request
> + // Bind the context CL to the current thread
> Thread.currentThread().setContextClassLoader
> (context.getLoader().getClassLoader());
> +
> + // Update the session last access time for our session (if any)
> + HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
> + String sessionId = hreq.getRequestedSessionId();
> + if (sessionId != null) {
> + Manager manager = context.getManager();
> + if (manager != null) {
> + Session session = manager.findSession(sessionId);
> + if ((session != null) && session.isValid())
> + session.access();
> + }
> + }
> +
> + // Ask this Context to process this request
> context.invoke(request, response);
>
> }
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>