Hi @aemnewbie ,
AEM already have functionality for invalidating cache(dispatcher flush agent) and that is recommended to use always as possible.
However, each entity may need some customization for some reason - in this case if you still want to export content path info, you have plenty of options to achieve it. One that suits here is
- Event Listener
- JCR Observer
You can implement and trigger it based on page activation then perform passing them to external agency though servlet API.
Piece of code sharing here for the same
try{
//retrieve the request parameters
String handle = request.getParameter("handle");
String page = request.getParameter("page");
//hard-coding connection properties is a bad practice, but is done here to simplify the example
String server = "localhost";
String uri = "/dispatcher/invalidate.cache";
HttpClient client = new HttpClient();
PostMethod post = new PostMethod("https://"+host+uri);
post.setRequestHeader("CQ-Action", "Activate");
post.setRequestHeader("CQ-Handle",handle);
StringRequestEntity body = new StringRequestEntity(page,null,null);
post.setRequestEntity(body);
post.setRequestHeader("Content-length", String.valueOf(body.getContentLength()));
client.executeMethod(post);
post.releaseConnection();
//log the results
logger.info("result: " + post.getResponseBodyAsString());
}
}catch(Exception e){
logger.error("Flushcache servlet exception: " + e.getMessage());
}Reference: https://github.com/AdobeDocs/experience-manager-dispatcher.en/blob/main/help/using/page-invalidate.md
Hope that helps!
Regards,
Santosh