Uploaded image for project: 'Advanced Cache'
  1. Advanced Cache
  2. MGNLADVCACHE-72

model class runs twice

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an issue
    • Neutral
    • None
    • None
    • DCP

    Description

      Here is my model class:

      package info.magnolia.groovy.test;
      
      import info.magnolia.rendering.model.*;
      import info.magnolia.rendering.template.configured.ConfiguredTemplateDefinition;
      import javax.jcr.Node;
      
      public class GroovyModelExample extends RenderingModelImpl {
       
          public GroovyModelExample(Node content, ConfiguredTemplateDefinition definition, RenderingModel<?> parent) {
              super(content, definition, parent)
              
              System.out.println("****GroovyModelExample ran******");
          }
       
          public String getJavaVersion() {
              return System.getProperty("java.version");
          }
      }
      

      Here is my configured template from the travel demo /travel-demo/templates/components/textImage.yaml:

      templateScript: /travel-demo/templates/components/textImage.ftl
      dialog: travel-demo:components/textImage
      
      renderType: freemarker
      modelClass: info.magnolia.groovy.test.GroovyModelExample
      fragmentDefinition: 
        class: info.magnolia.module.advancedcache.rendering.DynamicFragmentDefinition
        dynamic: true
        mechanism: sitemesh
        ttl: 0
      

      I activate the model (attached), the edited textImage template from resources, and the test page (attached) to public. I observe in my log every time I request the page the following:
      ***GroovyModelExample ran*****
      ***GroovyModelExample ran*****

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              rkovarik Roman Kovařík
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD