[MAGNOLIA-1938] Redirect doesn't work properly in mail sample Created: 08/Dec/07 Updated: 23/Jan/13 Resolved: 10/Dec/07 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | samples |
| Affects Version/s: | None |
| Fix Version/s: | 3.5 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Tom Jensen | Assignee: | Philipp Bärfuss |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
sun 1.5.0_07 |
||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
Here are the steps: 1) downloaded the latest tomcat bundled Magnolia from sourceforge (rc3) At this point I received the e-mail from Magnolia just fine but the page in the browser maintains the mail form's url (http://localhost:8080/magnoliaAuthor/mailform.html) and the HTTP redirect is never sent from the server. I double checked to ensure that it was pointing to a valid page for the redirect. I've also tried this in both Firefox and IE. I've also tried this off of the latest code from the trunk and I get the same problem. When I step through the code the problem seems to be a flag called include that gets set in the ApplicationHttpResponse object in tomcat to true. I don't understand tomcat internals enough to know what's going on so that's where I stopped. I did try this on my own jsp template where I put a redirect in and it never sends the redirect (same reason). I'm assuming that it isn't a tomcat issue though. |
| Comments |
| Comment by Philipp Bracher [ 10/Dec/07 ] |
|
In tomcat (5.0, 5.5) the redirect doesn't work after an include because org.apache.catalina.core.ApplicationHttpResponse does the following: public void sendRedirect(String location) throws IOException { if (!included) ((HttpServletResponse) getResponse()).sendRedirect(location); }I don't know if this is by spec and redirects do as well fail in other containers. The change was done in the process of implementing |
| Comment by Philipp Bracher [ 10/Dec/07 ] |
|
In JSP spec (2.0) point 5.4: "An included page cannot change the response status code or set headers. This precludes invoking methods like setCookie. Attempts to invoke these methods will be ignored. The constraint is equivalent to the one imposed on the include method of the RequestDispatcher class." |
| Comment by Philipp Bracher [ 10/Dec/07 ] |
|
I will solve that by doing the following:
|