Report #68 Details

Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: linked
Priority: high
Severity: critical
Confidence: public
Environment: 
   Release: 3.2 beta 3
   JVM Release: 1.2
   Operating System: Windows
   OS Release: 98
   Platform: PC

Synopsis: 
request.getSession() fails when followed by RequestDispatcher.include()

Description:
The following example is a servlet which opens a session, and then :
1- does nothing
2- include a JSP
3- forward to a JSP

cases 1 and 3 work fine : a JSESSIONID cookie is set, and the session context is 
retrieved
properly on the next requests.
Case 2 fails : the JSESSIONID cookie is not set. And a new session context is created 
at each request.

BUG ANALYSIS : 
--------------

With a debugger, one can see that the SessionInterceptor::beforeBody() method is not 
called in the
case 2 (include), but it is called in the other cases. (it is the method which create 
the JSESSIONID cookie).

It seems that the bug comes in the following method : 
HttpResponseAdapter.notifyEndHeaders(). 
The last test is false in the case of the JSP include. So the
doBeforeBody is not called. This is not good since the servlet should be capable to 
work on HTTP headers, open session,...
before it includes a JSP.


/** Signal that we're done with the headers, and body will follow.
 *  Any implementation needs to notify ContextManager, to allow
 *  interceptors to fix headers.
 */
   public void notifyEndHeaders() throws IOException {
           //   System.out.println("End headers " + request.getProtocol());
           if (request.getProtocol() == null)
                // HTTP/0.9 
                return;

           // let CM notify interceptors and give a chance to fix
           // the headers
BUG >>>    if (request.getContext() != null && notIncluded)
                request.getContext().getContextManager().doBeforeBody(request, this);

           // No action.. 
   } 




Title: BugRat Report # 68

BugRat Report # 68

Project: Tomcat Release: 3.2 beta 3
Category: Bug Report SubCategory: New Bug Report
Class: swbug State: linked
Priority: high Severity: critical
Confidence: public

Submitter: Lamberton ( [EMAIL PROTECTED] )
Date Submitted: Sep 5 2000, 05:59:57 CDT
Responsible: Z_Tomcat Alias ( [EMAIL PROTECTED] )

Synopsis:
request.getSession() fails when followed by RequestDispatcher.include()
Environment: (jvm, os, osrel, platform)
1.2, Windows, 98, PC

Additional Environment Description:
--

Report Description:
The following example is a servlet which opens a session, and then : 1- does nothing 2- include a JSP 3- forward to a JSP cases 1 and 3 work fine : a JSESSIONID cookie is set, and the session context is retrieved properly on the next requests. Case 2 fails : the JSESSIONID cookie is not set. And a new session context is created at each request. BUG ANALYSIS : -------------- With a debugger, one can see that the SessionInterceptor::beforeBody() method is not called in the case 2 (include), but it is called in the other cases. (it is the method which create the JSESSIONID cookie). It seems that the bug comes in the following method : HttpResponseAdapter.notifyEndHeaders(). The last test is false in the case of the JSP include. So the doBeforeBody is not called. This is not good since the servlet should be capable to work on HTTP headers, open session,... before it includes a JSP. /** Signal that we're done with the headers, and body will follow. * Any implementation needs to notify ContextManager, to allow * interceptors to fix headers. */ public void notifyEndHeaders() throws IOException { // System.out.println("End headers " + request.getProtocol()); if (request.getProtocol() == null) // HTTP/0.9 return; // let CM notify interceptors and give a chance to fix // the headers BUG >>> if (request.getContext() != null && notIncluded) request.getContext().getContextManager().doBeforeBody(request, this); // No action.. }

How To Reproduce:

Workaround:

View this Report online...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to