Why is this code left in the if(!requestRedirected) block?

  // Handle the case where a module may want to send
  // a redirect.
  if ( ( data.getStatusCode() == 301 ||
         data.getStatusCode() ==  302 ) &&
         data.getRedirectURI() != null )
  {
       data.getResponse()
           .sendRedirect ( data.getRedirectURI() );
  }

And is there any reason to set a status code before the redirect?  I ask
because the code above checks for it, but does not set it until
afterward  (most likely meant for non 301 or 302 responses.)  And in
your patch it is not set at all.  I'm just looking for clarification.

john mcnally


Glenn Golden wrote:
> 
> I've attached a patch file to make a change to turbine for jetspeed.
> 
> The change relates to how an Action class can request a URL redirect for the
> response, rather than processing the response to completion with a body and
> such.
> 
> To follow the Servlet HTTP rules, we must do the redirect before committing
> any headers or body to the response, and once we do a redirect we must not
> do anything else with the response.
> 
> Rundata already has a mechanism for specifying a redirect:
> setRedirectURI().  I propose that this is the standard way for an Action
> class to ask for a redirect. Just call this on your rundata with the URI for
> the redirect.
> 
> To smooth the path back from the Action exec, DefaultPage is modified by the
> patch to recognize that a redirect was set in the data, and to do an early
> return before doing anything else to the data's response, such as executing
> the screen and layout and such.
> 
> Finally, Turbine is modified by the patch to recognize the request for a
> redirect, implement the request, and make sure not to accidently open the
> output stream on the response in the attempt to make sure it is closed.
> 
> I have applied this patch to both the tip of the cvs, and to the version of
> turbine that Jetspeed is currently using (-r TURBINE_2_2_B1).  It works in
> both.
> 
> Thank you for your help in resolving this problem.
> 
> - Glenn
> 
> --------------------------------------------
> Glenn R. Golden, Systems Research Programmer
> University of Michigan School of Information
> [EMAIL PROTECTED]               734-615-1419
> http://www-personal.si.umich.edu/~ggolden/
> --------------------------------------------
> 
> > -----Original Message-----
> > From: John McNally [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, March 26, 2002 10:36 AM
> > To: Turbine Developers List
> > Subject: Re: Jetspeed / Turbine problems with redirects
> >
> >
> > Please send your changes as a "cvs diff -u".
> >
> > john mcnally
> >
> 
>   ------------------------------------------------------------------------
>                                             Name: 
>2002_03_26_turbine_redirect_patch.txt
>    2002_03_26_turbine_redirect_patch.txt    Type: Plain Text (text/plain)
>                                         Encoding: quoted-printable
> 
>   ------------------------------------------------------------------------
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to