tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: BugRat Report #68 - request.getSession() fails when followed by RequestDispatcher.include()
Date Wed, 03 Jan 2001 19:50:03 GMT
This sounds like a bug that was fixed in "beta 7" or "beta 8" -- I'd ask the submitter to try
it under the 3.2.1 release.

Craig


BugRat Mail System wrote:

> 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..
>    }
>
>   --------------------------------------------------------------------------------
>                         Name: Report-68.html
>    Report-68.html       Type: Hypertext Markup Language (text/html)
>                     Encoding: 7bit
>                  Description: DataSource attachment 'Report-68.html'


Mime
View raw message