You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Downs <pa...@positive-internet.com> on 2001/09/19 16:38:02 UTC

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

RE: Tomcat and Ultradev produced pages. response.sendRedirect problem.

Posted by Tony Abernethy <To...@ServaCorp.com>.
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:paul@positive-internet.com]
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


RE: Tomcat and Ultradev produced pages. response.sendRedirect problem.

Posted by Paul Downs <pa...@positive-internet.com>.
Hi,

> suggest you look in on
> http://www.macromedia.com/support/dreamweaver/extend/form/ where

  The problem with that is we are a hosting company and they are customers. 
In their eyes it should "work out of the box" and I can agree with that, as 
the code looks fine.  I have had this sort of code working before under 
resin and a few other servlet environments.  However the more recent 
(3.2.x) tomcat engines don't like it.
  I am inclined to lay blame at tomcats door or one of the supporting jars 
or jsdk classes.

Paul

Paul

Re: Tomcat port configuration

Posted by Jonathan Eric Miller <je...@uchicago.edu>.
It's been awhile since I've looked at Tomcat 3.x, but, if it's like 4.0,
it's just a setting in conf/server.xml. Do a search in that file for 8443.
Basically, just changes all the values of 8443 in that file to 443.

Jon

----- Original Message -----
From: "Peter L. Markowsky" <pe...@ccs.neu.edu>
To: <to...@jakarta.apache.org>
Cc: "Paul Downs" <pa...@positive-internet.com>
Sent: Wednesday, September 19, 2001 11:37 AM
Subject: Tomcat port configuration


> I've run into a small problem using tomcat-3.2.3 in that the
> secure port 8443 that it uses for https is blocked by a firewall and is
> not allowed. However the port 443 is allowed, that I'm told apache
> uses. So the question is how do I switch which port tomcat listens on for
> https? and can I? I'm running win2k server edition and downloaded a binary
> version of tomcat-3.2.3 thanks for the help in advance.
> -Pete
>
>


Tomcat port configuration

Posted by "Peter L. Markowsky" <pe...@ccs.neu.edu>.
	I've run into a small problem using tomcat-3.2.3 in that the
secure port 8443 that it uses for https is blocked by a firewall and is
not allowed. However the port 443 is allowed, that I'm told apache
uses. So the question is how do I switch which port tomcat listens on for
https? and can I? I'm running win2k server edition and downloaded a binary
version of tomcat-3.2.3 thanks for the help in advance.
							-Pete



RE: Tomcat and Ultradev produced pages. response.sendRedirect problem.

Posted by Danny Angus <da...@thought.co.uk>.
Actually you can alter and wildly extend the behaviour (and develop plug-in
type new functionality) from that which ships with Ultradev, I suggest you
look in on http://www.macromedia.com/support/dreamweaver/extend/form/ where
you can sign up for a closed news group where you'll get good advice, also
look at the "extending ultradev" manual.

> -----Original Message-----
> From: Paul Downs [mailto:paul@positive-internet.com]
> Hi,
>   We have several customers using Ultradev
> everything seems fine
> However
> you occasionally get strange data.