The code that Ultradev produces has a couple of problems.
First, there is a CR-LF which is taken as HTML between the first and second
lines.
Emitting HTML will most likely cause default HTML headers to be issued.
Second, there is NO return; after the redirect, so the program continues on
its merry way producing the HTML that is supposed to be stopped.

Add return; after the redirect.
Close up the CR-LFs between %> and <%, putting the spaces in the java where
they are relatively harmless.
Otherwise you have a race condition between the headers and the HTML with
unreliable results, not even reliable failure.

EXAMPLE:
<%@page contentType="text/html; charset=iso-8859-1" language="java"
import="java.sql.*"%>
<%
...
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
}
%>
// no return;, so code here is executed.

-----Original Message-----
From: Paul Downs [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 19, 2001 9:38 AM
To: tomcat
Subject: Tomcat and Ultradev produced pages. response.sendRedirect
problem.


Hi,
  We have several customers using Ultradev to produce jsp for their site,
everything seems fine, especially if you use non IE browsers.  However for
response.redirect we get either, the original page after a submission then
some garbled cache type data and then the correct destination page.  Or for
simple links you occasionally get the strange cache data.  It looks like
this:

HTTP/1.1 200 Date: Tue, 11 Sep 2001 16:31:26 GMT Server: Apache Keep-Alive:
timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1 a4e

  I know how to massage to the jsp to stop this, with the original line
commented out:

      response.setStatus( 301 );
      response.setHeader( "Location", MM_editRedirectUrl );
      response.flushBuffer();

//response.sendRedirect(response.encodeRedirectURL(MM_editRedirectUrl));

  However massaging UltraDevs code all the time is not really practical! :)
  My question is what causes this behaviour? I presume the other browsers
never display it, or display correctly because they don't show anything
until the <html> or Content-Type: label.  So seeing as we cannot alter
Ultradevs behaviour and we definately cant alter IE's how do I get tomcat
stop this?  With our previous servlet runners i never experienced this.

*phew* Long post....  Thanks if you made it this far.

Paul

Reply via email to