4 Replies Latest reply on Mar 21, 2013 8:59 PM by Sham HC

    Provide alternative JSON renderer? Without losing default JSON renderer?



      Construct some custom JSON rendition of a page. For example: /content/site/page.my.json


      And we want to accomplish this without losing the out-of-the-box functionality:


      • /content/site/page.html - WORKS OUT OF THE BOX
      • /content/site/page.json - WORKS OUT OF THE BOX




      We've added a jsp to our global page template and named it my.json.jsp. This has given us this behavior:


      • /content/site/page.my.json - INVALID RECURSION SELECTOR (the request gets handled by default json renderer and "my" is not a valid recursion selector)
      • /content/site/page/_jcr_content.my.json - WORKS (we can see our custom json renderer working), but we have other reasons we cannot use this URI.


      So we're nearly there. Next, we add "json" to the list of extensions that are treated with default resolution behavior, by going to felix config and editing the "Apache Sling Servlet/Script Resolver And Error Handler:


      By doing this, now our custom json WORKS, but we get the following results:

      • /content/site/page.my.json  - WORKS (our custom JSON renders)
      • /content/site/page.json - DOESN'T WORK (html is rendered rather than the default JSON renderer)


      How can we provide this custom renderer at *.my.json without losing the functionality of the default  *.json renderer, necessary for dialogs in the page properties, etc.