I have JSON service exposed to other system from AEM ex: https:domainname/content/portal/services/apidata.getMenuData.json
This is achieved as below.
The data which needs to shared in JSON is configured in webpage say "/content/portal/menuconfig.html" via dialogue.
There is service component with "getMenuData.json.jsp" to read data from "/content/portal/menuconfig.html"
getMenuData.json.jsp code looks as below :
getMenuData.json.jsp :
String xPathQuery = "/jcr:root/content/portal/menuconfig/jcr:content/body/menuconfigurarions";
Session session = resourceResolver.adaptTo(Session.class);
QueryManager qm = session.getWorkspace().getQueryManager();
Query q = qm.createQuery(xPathQuery, "xpath");
QueryResult result = q.execute();
NodeIterator nIt = result.getNodes();
Property prop = null;
while(nIt.hasNext()) {
Node node = nIt.nextNode();
//read the dialogue value and convert to array and assign to output object
if(node.getName().equals("menuconfigurarions") && node.hasProperty("items")) {
...
prop = node.getProperty("items");
MenuList = prop.getValues();
...
outputString = menuconfigurarionsArray.toString();
..... } else { ...} }.....
response.setContentType("application/json");
out.println(outputString);
Once page is edited and activated then flush agent invalidating https:domainname/content/portal/menuconfig.html but https:domainname/content/portal/services/apidata.getMenuData.json is not getting invalidated. How to achieve JSON path invalidation on dispatcher when activating "menuconfig.html" webpage.