[BLOSSOM-40] Model not emptied after rendering of paragraph completes Created: 25/Jan/11 Updated: 06/Dec/14 Resolved: 04/Mar/11 |
|
| Status: | Closed |
| Project: | Blossom |
| Component/s: | None |
| Affects Version/s: | 1.2.1 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Philipp Gaschütz | Assignee: | Tobias Mattsson |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Magnolia 4.4.1, Blossom 1.2.1, Tomcat-6, Java 6 |
||
| Attachments: |
|
| 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 |
|
It seems as if the ModelMap is not cleared between internal paragraph renders and values from the previous paragraphs ModelMap are accessible in subsequent paragraphs views if not overwritten. Having two Blossom Controllers, the first returns a model, the second one returns no model for the view. @Paragraph(name = "test1", value = "Test1") @RequestMapping("/test1.do") @TabFactory("Content") } and @Paragraph(name = "test2", value = "Test2") @TabFactory("Content") } Both views contain just TestController1 runs fine. If TestController2 is run for a subsequent paragraph, the view will output "test1" as well, although no Model was returned. Returning an empty Model doesn't fix this either. TestController2 needs to return a ModelMap with the attribute "text" explicitly set to null in order to archieve the desired result. |
| Comments |
| Comment by Tobias Mattsson [ 26/Jan/11 ] |
|
Hi Philipp, Spring Web MVC by default cleans up any request attributes set within an include. This means that subsequent includes don't see each others attributes while nested includes do see the attributes of outer includes. The reason you're seeing this problem is that in the bridge between Magnolia and Spring Web MVC a forward operation is used if possible otherwise it does an include. The result being that a forward is done to the template, then on the first level of paragraphs is also a forward, nested paragraphs however are includes. Therefore Spring doesn't do cleanup on the first level of paragraphs. I do think that it is a good idea to change this so that paragraphs are always included and have their request attributes scoped to only be available within the include and removed afterwords. Attributes set by the template will be available to all paragraphs and attributes set by a paragraph will be available to all nested paragraphs below it in the hierarchy. Please try out the attached snapshot that behaves like i've described above and let me know how that works out. |
| Comment by Philipp Gaschütz [ 27/Jan/11 ] |
|
Hi Tobias, Thanks for your explanation! I'll give this a try, but won't get a chance until sunday. Thanks, |
| Comment by Tobias Mattsson [ 27/Jan/11 ] |
|
Hi Philipp, I tested them on the same level and the issue in deed goes away with the changes i made in the snapshot i sent you. Let me know how it works out. // Tobias |
| Comment by Tobias Mattsson [ 10/Feb/11 ] |
|
Fix committed to trunk. |
| Comment by Jan Haderka [ 06/Dec/14 ] |
|
Bulk close of old resolved issues. |