Bug 53624 - sendRedirect doesn't work after a dispatch through the AsyncContext
Summary: sendRedirect doesn't work after a dispatch through the AsyncContext
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.29
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 53627 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-30 19:07 UTC by Rossen Stoyanchev
Modified: 2012-08-14 22:50 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rossen Stoyanchev 2012-07-30 19:07:39 UTC
A call to sendRedirect after AsyncContext.dispatch doesn't redirect and returns with a 200 status code instead.

A project demonstrating the issue:
https://github.com/rstoyanchev/dispatch-test

Build and deploy the source in the 'tomcat-issue-repro'. From the home page of the deployed application, select the "Redirect" scenario. The scenario involves Servlet "RedirectA" that creates a thread and dispatches to Servlet "RedirectB", which in turn redirects to Servlet "RedirectC" and that forwards to a simple JSP page. Instead of the JSP page rendering, you should see a blank page and the log output will show that processing ended at ServletC.

For details on the setup see WebAppInitializer.setupRedirectScenario(ServletContext).

---

FWIW if a forward is used instead of a dispatch from the async thread, the scenario works. To do that, modify the line that creates servlet "RedirectA" to be ForwardingAsyncServlet instead of DispatchingAsyncServlet.

---

This issue is very similar to 51197, which was marked resolved in 7.0.25. The current issue was tested against 7.0.29.
Comment 1 Mark Thomas 2012-08-14 22:39:05 UTC
This looks to have a different root cause.

This has been fixed in trunk and 7.0.x and will be included in 7.0.30 onwards.
Comment 2 Mark Thomas 2012-08-14 22:50:45 UTC
*** Bug 53627 has been marked as a duplicate of this bug. ***