You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Milo Hyson <mi...@cyberlifeservices.com> on 2000/05/30 04:23:41 UTC

Serious redirect bug

I just installed the Tomcat 3.1 sources. Everything works fine except for
this one major issue. Redirects (i.e. HttpServletResponse.sendRedirect())
don't work properly. It appears that after calling this method, the servlet
doesn't terminate. It keeps on processing subsequent lines of code resulting
in corrupted responses being sent to clients. However if you put a return
after the method call, everything works fine.

I've tried multiple installations on two different machines with the same
result overtime.

The Java Servlet Specification 2.2 Section 6.3 states the following:

"These methods will have the side effect of committing the response, if it
had not already been
committed, and terminating it. No further output to the client should be
made by the servlet after
these methods are called. If data is written to the response after these
methods are called, the data is
ignored."

If this is not already being handled I hope it gets fixed soon.

- Milo Hyson
CyberLife Labs



Re: Serious redirect bug

Posted by Milo Hyson <mi...@cyberlifeservices.com>.
Sorry, I didn't word my message properly. I understand and agree that the
spec is referring to simply terminating the response to the client, not the
actual servlet thread.

Personally I feel it's good practice to put a return after a sendRedirect
call. However I can see where it might be useful to continue with other code
afterwards. For example, one might need to clean up some back-end resources.

----- Original Message -----
From: "Arion" <ar...@talentinfo.com.hk>
To: <to...@jakarta.apache.org>
Sent: Monday, May 29, 2000 7:51 PM
Subject: Re: Serious redirect bug


> Hi!
>
> Sorry I have missed the following:
>
> "If data is written to the response after these methods are called, the
data is
> ignored."
>
> But it seems making the flow of program difficult to trace if allowing
doing
> something with no-effect.
>
> Arion
>
> Arion wrote:
>
> > Hi!
> >
> > What I got the meaning for the phrase:
> >
> > "No further output to the client should be made by the servlet after
these
> > methods are called."
> >
> > The servlet should not make output to the client, not the servlet engine
not
> > letting the servlet making output to the client.
> >
> > Arion
> >
> > Milo Hyson wrote:
> >
> > > I just installed the Tomcat 3.1 sources. Everything works fine except
for
> > > this one major issue. Redirects (i.e.
HttpServletResponse.sendRedirect())
> > > don't work properly. It appears that after calling this method, the
servlet
> > > doesn't terminate. It keeps on processing subsequent lines of code
resulting
> > > in corrupted responses being sent to clients. However if you put a
return
> > > after the method call, everything works fine.
> > >
> > > I've tried multiple installations on two different machines with the
same
> > > result overtime.
> > >
> > > The Java Servlet Specification 2.2 Section 6.3 states the following:
> > >
> > > "These methods will have the side effect of committing the response,
if it
> > > had not already been
> > > committed, and terminating it. No further output to the client should
be
> > > made by the servlet after
> > > these methods are called. If data is written to the response after
these
> > > methods are called, the data is
> > > ignored."
> > >
> > > If this is not already being handled I hope it gets fixed soon.
> > >
> > > - Milo Hyson
> > > CyberLife Labs
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>


Re: Serious redirect bug

Posted by Arion <ar...@talentinfo.com.hk>.
Hi!

Sorry I have missed the following:

"If data is written to the response after these methods are called, the data is
ignored."

But it seems making the flow of program difficult to trace if allowing doing
something with no-effect.

Arion

Arion wrote:

> Hi!
>
> What I got the meaning for the phrase:
>
> "No further output to the client should be made by the servlet after these
> methods are called."
>
> The servlet should not make output to the client, not the servlet engine not
> letting the servlet making output to the client.
>
> Arion
>
> Milo Hyson wrote:
>
> > I just installed the Tomcat 3.1 sources. Everything works fine except for
> > this one major issue. Redirects (i.e. HttpServletResponse.sendRedirect())
> > don't work properly. It appears that after calling this method, the servlet
> > doesn't terminate. It keeps on processing subsequent lines of code resulting
> > in corrupted responses being sent to clients. However if you put a return
> > after the method call, everything works fine.
> >
> > I've tried multiple installations on two different machines with the same
> > result overtime.
> >
> > The Java Servlet Specification 2.2 Section 6.3 states the following:
> >
> > "These methods will have the side effect of committing the response, if it
> > had not already been
> > committed, and terminating it. No further output to the client should be
> > made by the servlet after
> > these methods are called. If data is written to the response after these
> > methods are called, the data is
> > ignored."
> >
> > If this is not already being handled I hope it gets fixed soon.
> >
> > - Milo Hyson
> > CyberLife Labs
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Serious redirect bug

Posted by Arion <ar...@talentinfo.com.hk>.
Hi!

What I got the meaning for the phrase:

"No further output to the client should be made by the servlet after these
methods are called."

The servlet should not make output to the client, not the servlet engine not
letting the servlet making output to the client.

Arion

Milo Hyson wrote:

> I just installed the Tomcat 3.1 sources. Everything works fine except for
> this one major issue. Redirects (i.e. HttpServletResponse.sendRedirect())
> don't work properly. It appears that after calling this method, the servlet
> doesn't terminate. It keeps on processing subsequent lines of code resulting
> in corrupted responses being sent to clients. However if you put a return
> after the method call, everything works fine.
>
> I've tried multiple installations on two different machines with the same
> result overtime.
>
> The Java Servlet Specification 2.2 Section 6.3 states the following:
>
> "These methods will have the side effect of committing the response, if it
> had not already been
> committed, and terminating it. No further output to the client should be
> made by the servlet after
> these methods are called. If data is written to the response after these
> methods are called, the data is
> ignored."
>
> If this is not already being handled I hope it gets fixed soon.
>
> - Milo Hyson
> CyberLife Labs
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org