[MAGNOLIA-2395] fix hack related to MAGNOLIA-2186 and MAGNOLIA-923 Created: 25/Sep/08  Updated: 23/Jan/13  Resolved: 29/Oct/08

Status: Closed
Project: Magnolia
Component/s: core, templating
Affects Version/s: 4.0
Fix Version/s: 4.0

Type: Bug Priority: Major
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: freemarker
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-2010 WebContextImpl.include() should use p... Closed
is related to MAGNOLIA-923 allow use of jsp tags in freemarker t... Closed
is related to MAGNOLIA-2186 Provide support for freemarker (page)... Closed
is related to MAGNOLIA-1646 Makes jsp pageContext available in We... Closed
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   

I encountered a bug when using tags (of the Tag sort, SimpleTags work fine) in paragraph templates. Somehow the writer of the pageContext gets lost, and freemarker does not like it: from TagTransformModel:

            if(out instanceof JspWriter) {
                if(out != pageContext.getOut()) {
                    throw new TemplateModelException(
                       "out != pageContext.getOut(). Out is " +
                        out + " pageContext.getOut() is " +
                        pageContext.getOut());
                }
                usesAdapter = false;
            } else {
                out = new JspWriterAdapter(out);
 // etc...

There are multiple approaches:

  • currently, the include tag passes the pageContext.getOut to the paragraph renderer. This trigger the if block above. Include tag could wrap the JspWriter in a regular writer. This is how I fixed it with r18328
  • fixing freemarker by omiting this if block - I'll contact the developers to try and understand what the reasoning is
  • figure out a way to not loose the pageContext/writer when rendering paragraphs. I'm pretty unsure how that happens as of now.


 Comments   
Comment by Magnolia International [ 25/Sep/08 ]

i wonder if there's a relation with MAGNOLIA-1646 (i.e if the pageContext should be propagated further)

Comment by Magnolia International [ 25/Sep/08 ]

Also see MAGNOLIA-2010 before final fix.

Comment by Magnolia International [ 26/Sep/08 ]

Ok, revision 18328 definitely isn't the right choice, it JSPs aren't rendered any more

Comment by Philipp Bracher [ 03/Oct/08 ]

Hm, while I worked on the renderers I noted that the jsp paragraphs are not renderer and so have been able to fix it by flushing the output stream in the render method of the paragraph renderer. So the issue might be fixed now.

Comment by Philipp Bracher [ 03/Oct/08 ]

forgot to mention that the change is still in my local copy.

Comment by Magnolia International [ 06/Oct/08 ]

Yeah - as mentioned, the fix I "applied" for freemarker rendering breaks the jsp paragraphs rendering and needs to be reverted as such.
This needs to be resolved for both jsp and freemarker before this issue, MAGNOLIA-2186 and MAGNOLIA-923 can be closed.

Comment by Jan Haderka [ 29/Oct/08 ]

Freemarker "fix" is now applied in FreemarkerParagraphRenderer instead of in the tag itself. Changed as part of MAGNOLIA-2387.

Generated at Mon Feb 12 03:36:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.