-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brad,

On 2/17/2009 12:32 AM, Brad Whitaker wrote:
>         try {
> 
>             if(LOG.isDebugEnabled()) {
>                 LOG.debug("Executing redirect with response
> ["+response+"]");
>             }
>             String redirectUrl = response.encodeRedirectURL(actualUri);
>             response.sendRedirect(redirectUrl);
> 
>         } catch (IOException e) {
>             throw new ControllerExecutionException("Error redirecting
> request for url ["+actualUri +"]: " + e.getMessage(),e);
>         } catch (Exception ex) {
>             LOG.error("redirectResponse: caught Exception=" + ex);
>             throw new ControllerExecutionException("Error redirecting
> request for url [" + actualUri + "]: " + ex.getMessage(), ex);
>         }
>         return null;

This should totally work.

> I'm certain that the redirect is never sent to the browser. I've been using
> Firebug and HttpWatch to monitor each request and response. When I execute
> this code on Jetty I do see the redirect sent to the browser.

How do you know that no exceptions are being thrown?

> I took a look at the Error Handling sections of the Servlet spec and it
> wasn't clear to me if perhaps the redirect is not permitted after an
> exception has been thrown.

Exceptions are orthogonal to request/response processing. If you allow
the exception to propagate (that is, you don't catch it), then Tomcat
typically sends a 500 Server Error response to the client. There is no
requirement for exception handling in the servlet spec (other than those
implied by the API itself) and no reason a "regular" response can't be
given even in an exceptional condition.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmcXiIACgkQ9CaO5/Lv0PArfQCdFhJqH2nEPLirJrjfo8+P7Efk
V/IAnRFdu9dTlMd7B/m3zlut1Xk7Ej5t
=Mb/0
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to