RoyValentine
RoyValentine

Reputation: 143

CQ5 Invalid recursion selector value 'data' (data.json.jsp)

Let's say I have a page in CQ5. I created this page using a template with a single component, call it tableComp, and I hit at url Test.html. The component contains its standard JSP file but the page template being used also contains a specific JSP for JSON or XML rendering of custom data, not page data.

This JSP file for rendering would be named something like data.xml.jsp or data.json.jsp. To hit this rendering JSP for the page Test.html you would call /content/{org}/desktop/en_US/{name}/Test.data.json or /content/{org}/desktop/en_US/{name}/Test.data.xml.

The XML/JSON JSP would be called which contains code to just get values and print to the screen XML or JSON. Ex: Blah

Now I want to display information to the screen as a JSON output when I hit a new file named data.json.jsp. When hitting data.xml.jsp it works correctly and hits the JSP. When I do the exact same process for the data.json.jsp I then get the following.

Invalid recursion selector value 'data' 
Cannot serve request to /content/{org}/desktop/en_US/{name}/Test.data.json in org.apache.sling.servlets.get.DefaultGetServlet

Request Progress:

      0 (2015-07-22 18:10:06) TIMER_START{Request Processing}
      0 (2015-07-22 18:10:06) COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message>
      0 (2015-07-22 18:10:06) LOG Method=GET, PathInfo=/content/{org}/desktop/en_US/{name}/Test.data.json

I have tried adding a Pages.json.jsp file to the /libs/foundation/components/primary/cq/Page section as suggested in another forum but this did not help. The content of this Pages.json.jsp file was <%@include file="proxy.jsp"%>.

How can I get JSON to work for this type of request?

EDIT:

I have changed my original explanation to clarify my problem.

Upvotes: 1

Views: 3813

Answers (1)

rakhi4110
rakhi4110

Reputation: 9281

Looks like the request is being handled by the DefaultGetServlet which in turn uses the JsonRendererServlet to process your requests with .json extensions.

Since the JsonRendererServlet requires a numeric selector or the infinity selector, it throws the following error.

Invalid recursion selector value <<selector>>

However requesting /Test/_jcr_content.data.json would render the JSON data processed by the data.json.jsp instead of the DefaultGetServlet.

Upvotes: 2

Related Questions