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

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.

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.

Related

Display error message in HTML from Webseal

Hello I have an error page for user when their account gets locked. When I view the source code of page it just contains one line
%ERROR%
I am trying to understand if this is some kind of string interpolation as I have never seen it done with % sign. The error message that is displayed is this
The raw file you are viewing is a response page template. When that page is presented to the client making the request, the %MACRONAME% values are substituted and the HTML (or JSON) content returned from the web reverse proxy has that substituted text. Hint, you can further customize the messages to the user by substituting the macro into a javascript variable within the response page template, and then make logic decisions based on that client side javascript code. For example, you could catch one of the IBM error codes and translate it into saying something like "Account is locked".
More information is available on the macros within the IBM documentation.

C# Sending Json body that includes a file

I have a C# project that
gets a request to do work
performs the work
returns to the api a json object containing the results of the request
This is working fine. As the work is done there is a log file that gets populated with various information (date being processed, errors encountered, etc.). I want to include a request type that would tell my program to return to the API the log file. Because I want this to be "just another request" I am trying to figure out how to include the file as part of the json body being returned. Is this possible? Is there a way to include a file (actual file - not just the contents of the file) in the json body?
I know how to return the file as it's own post - is there a way to return a json AND a file in the same post or am I looking at 2 separate post requests? One for the json body and a separate post that would send the file?

Why is MVC JsonResult controller method returning HTML markup in browser

So I have a controller called 'HistoryController' which has a 'JsonResult' action which returns json data.
There is no associated View or Model with this method.
When I enter the url .../HistoryController/GetData, I get strange behaviour.
Instead of getting the json data (or maybe even an error message), I get the entire master page markup back in the browser. Why is this?
All I want is for some json data to show in browser but what I get is this:

load rdf/json from URL using DotNetRDF

I'm new to the World of triplets :-) I'm trying to use DotNetRDF to load the SOLR searchresult into a Graph using DotNetRDF.
The URL I'm getting data from is:
https://nvv.entryscape.net/store/search?type=solr&query=rdfType:https%5C%3A%2F%2Fnvv.entryscape.net%2Fns%2FDocument+AND+context:https%5C%3A%2F%2Fnvv.entryscape.net%2Fstore%2F1
The format is supposed to be "RDF/JSON". No matter what parser or what I try - I only get "invalid URI". Have tried to load from the URL and also tried downloadning the result to a file and load from file, same error.
I'm using VS2017 and have "nugetted" the latest version of DotNetRdf.
Please help me, what am I missing?
Regards,
Lars Siden
It looks like the JSON being returned by that endpoint is not valid RDF/JSON. It does appear to contain some RDF/JSON fragments but they are wrapped up inside another JSON structure. The RDFJSONParser in dotNetRDF requires that your entire JSON document be a single, valid chunk of RDF/JSON.
The value at resource.children[*].metadata is an RDF/JSON object. So is the value at resource.children[*].info. The rest is wrapper using property names that are not valid IRIs (hence the parser error message).
Unfortunately there is no easy way to skip over the rest of the JSON document and only parse the valid bits. To do that you will need to load the JSON document using Newtonsoft.JSON and then serialize each valid RDF/JSON object you are interested in as a string and load that using the RDFJSONParser's Load(IGraph, TextReader) or Parse(IRdfHandler, TextReader) method.

Parameter Passing from ExtJs to Html

I am trying to pass an Extjs parameter ,which I retrieved from a store in the code, to html code.
Any ideas?
ok.so here is the structure.
I am trying to make an ajax call with updater.update from jsp.
The call goes to controller and returns a jsp which includes another jsp(jsp include is used)
the jsp ,which is included by the other one, needs an attribute which is on a store object. So I need to fetch it from the store and place it on the html side.
Is it more clear now?
Thanks for your replies
PS: Actually my real problem is: the jsp ,which is included by the other jsp, includes scripts and as I have read from the responses on internet, to call a jsp page(which includes javascripts) through ajax and try to render it, is not possible on ie7 and ie 8(the famous "Could not complete the operation due to error 80020101" error ). Is it correct?