Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6966

Sling Models Jackson Exporter always uses default Resource serialization for a model class which extends AbstractResource or implements the Resource interface

    XMLWordPrintableJSON

Details

    Description

      If there is a model class which looks like this:

      @Model(adaptable = SlingHttpServletRequest.class, resourceType = "something")
      @Exporter(name = "jackson", extensions = "json")
      public class Foo extends AbstractResource {
      
      ....
      
      }
      

      Then attempts to export this resource will always use the default Resource serialization and not use the "bean" serialization technique used by Jackson. This is because Jackson will first find the ResourceSerializer based on the Resource interface before constructing a BeanSerializer. The serializer lookup logic should be customized to skip any class with the @Model annotation.

      Attachments

        Activity

          People

            justinedelson Justin Edelson
            justinedelson Justin Edelson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: