I created the workflow and added the process step. in the java class am trying to clear the cache using the below piece of code.
//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();
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();
https://docs.adobe.com/docs/en/cq/5-6/deploying/dispatcher/page_invalidate.html
This is not working from author instance and not using the above code in servlet its just normal java class. please let me know what will b the best way.
we need to provide the workflow to user to clear the particular page cache(need not be the current page).
Thanks in advance.
Hi Ramyan,
Facing similar task, solution was not to use raw REST post but to create a dummy path and flush it using the:
com.day.cq.replication.Replicator API
This seemed like the most feasible approach.
Thanks,
Peter
Views
Replies
Total Likes
Hi Thanks for the response. Can you explain the approach with some more details.
Views
Replies
Total Likes
How you already looked here?
http://adobe-consulting-services.github.io/acs-aem-commons/features/dispatcher-flush-ui.html
Views
Likes
Replies