[MAGNOLIA-3234] Make it possible to skip rendering Created: 23/Jun/10  Updated: 13/Mar/12  Resolved: 30/Jun/10

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: None
Fix Version/s: 4.3.3, 4.4

Type: Task Priority: Major
Reporter: Federico Grilli Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MGNLSTK-643 Provide a "redirect" template Closed
is causing MGNLRES-27 ResourcesTextTemplateRenderer.determi... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:

 Description   

When realizing the new redirect functionality the need arose for skipping the rendering of templates under certain conditions. This can be achieved by skipping the call to the onRender(..) method in AbstractRenderer.render(..) method when the determineTemplatePath(..) method for a certain template returns null. So far, this caused an IllegalStateException but now this should not be the case anymore and a null templatePath would simply mean 'do not render anything'.



 Comments   
Comment by Magnolia International [ 24/Jun/10 ]

needs to be merged to trunk

Comment by Philipp Bärfuss [ 24/Jun/10 ]

Federico says:

Basically it works, just need to write the update tasks. However, yesterday Greg had a quick look at the implementation and raised some doubts:

1) extra logic in AbstractRenderer
2) throwing an Exception when a templatePath was null was a good hint in case of template definition misconfigurations
3) the resources module now is dependent on 4.3.3

What he proposed was to use a special new Renderer for the redirect template

Comment by Philipp Bärfuss [ 24/Jun/10 ]

So instead we should introduce a special actionResult (value returned by mode.execute()) which will skip the rendering.

if(!skipRendering(actionResult)){
render
}

Unfortunately this value cannot be null or "" as this are the default values. So use "skip-rendering".

Benefits:

  • no changes in the resource module needed
  • no special template definition class

We could even go as far as supporting the same pattern as for virtual URIs -> "redirect:URI", "forward:URI"

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