Invalidate JSON service cache on webpage activation. | Community
Skip to main content
Level 2
November 28, 2023

Invalidate JSON service cache on webpage activation.

  • November 28, 2023
  • 2 replies
  • 653 views
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.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Shashi_Mulugu
Community Advisor
Community Advisor
December 7, 2023

@kyasam if the page path is not matching with your content service path, you need write ACS commons Generic rules..

kautuk_sahni
Community Manager
Community Manager
January 3, 2024

@kyasam Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni