Roger Haase wrote:
--- Stuart Donaldson <> wrote:

Awake and sleep are both called while in the forward() call to a new 
servlet.  The forwarding servlet (the one calling forward()) does not

finish processing until after the forward() call is through, so the 
forwarding servlet will not go to sleep until then.

ServletA forwarding to Servlet B, the steps on the servlets are along

the lines of the following with some processing left out.

       ... process response and determine need to forward...
       A.forward( URL to servlet B )
            createServletInTransaction()  locates the servlet and 
attaches it to the transaction.

You can check request.parent() to see if you are in a forwarded or 
included requestt, it returns the parent servlet, or None if there is

Note that this behavior is similar for forard() includeURL() and 

I am under the impression the sequence of calls described above does
not apply to trans.response().sendRedirect(url).  After calling
trans.response().redirect(url) in a.awake();  a.respond(), and
a.sleep() will run before b.awake(), b.respond(), and b.sleep().  Any
output from "a" after calling redirect will be thrown away.  The main
difference between forward() and sendRedirect() is the browser's url
will be  updated with sendRedirect(). Is this correct?

The new method Page.sendRedirectAndEnd(url) described in the
RelNotes-0.8 document is probably more useful and less confusing than
either sendRedirect() or forward() and probably deserves a mention in
the User's Guide. 

Roger Haase

Yes, that's pretty much correct.  The sendRedirect sends the redirect
to the browser.  The new URL will be requested in a new transaction.

Note that the redirected URL will take effect asynchronously to
the transaction sending the redirect.  It is theoretically possible
for the new transaction to begin before the transaction which issued
the redirect has done a sleep().  Although not very likely, and in fact
you might have to have an unusual bit of code in the initial transaction
to get that to happen.  

I agree that the sendRedirectAndEnd(url) is probably the best
thing to use.

Can anyone think of any reasons to use response().sendRedirect(URL)
rather than the Page.sendRedirectAndEnd(URL)?