I used the geometrixx site as an example, but in my real use-case the target page has a json.jsp in its component that creates a custom JSON response when accessed (eg. /content/geometrixx-media/en/entertainment/jcr:content.json)
I'm not sure why the above does not work for a JSON response.
I eventually found the solution. It is impossible to return the json output of the content structure (eg. /content/geometrixx-media/en/entertainment.infinity.json) presumably because the response includes a application/json response header.
For my purposes I needed to target the output of my custom json.jsp in my content component (eg. /content/geometrixx-media/en/entertainment/jcr:content.json)
Originally my json.jsp included a response header to identify the response as JSON. Removing this header allowed the JSON to be properly returned via the requestResponseFactory.
I think this confirms that requestResponseFactory specifically excludes responses based on the response header. I would consider this to be a bug as this prevents the requestResponseFactory from accessing the default JSON output of a node.
I have confirmed that JSON is enabled in the Apache Sling GET Servlet configuration. It still does not return JSON using the above method.
The page that I'm referencing does have a custom json.jsp in its component which is in fact the output I would like to return in the request, but even when I request the geometrixx page that does not have a custom json.jsp in it's component it still does not return JSON in the request.
When I access the target page directly, the page returns the correct JSON and if I use a sling:include on the parent page it also returns the correct JSON, but I need to be able to return the JSON from the target page within my JSP file so that I can combine it with JSON from other pages.
Can the SlingRequestProcessor return the rendered JSON output of a page that has a custom json.jsp in it's component?
For example: /content/geometrixx-media/en/entertainment/jcr:content.json
Note that I'm requesting the JSON output of the jcr:conent of the page.