I do believe that is standard behavior.  You need to make sure that the
redirect happens last.

-----Original Message-----
From: Cristian Satnic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 10:53 AM
To: JRun-Talk
Subject: response.sendRedirect weirdness ?!?


Hi list,

I just made an interesting discovery that will affect the way we structured
our application here (and probably affect other people too).

Check the code below:

<%

response.sendRedirect("http://www.yahoo.com";);

System.out.println("Started - " + new java.util.Date());
for(int i=0; i<1000000000; i++) {}
System.out.println("Done - " + new java.util.Date());

%>


We have a response.sendRedirect followed by a very long for loop (if you
look at the times, you'll see that it takes about 15 seconds to do the
loop).  Yet, you'll get redirect to yahoo immediately.

The point is that a response.sendRedirect will redirect immediately while
allowing the code to continue execution.  If the code after does cleanup of
SHARED resources between the 2 pages (such as a db connection), you could
get in a situation where the new page starts working on something and all of
a sudden the old page cleans up the resources, resulting in all kinds of
errors.

I assume that this is more or less standard jsp behavior, though I could not
really find it spelled out clearly anywhere.

Just to let you know,
Cristian

----------------------------------
Cristian Satnic
Sr. Consultant
Tigris Consulting
212.481.1174 x10
[EMAIL PROTECTED]

Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to