How to get the path of the page being published?
I need to hit a servlet whenever the author publishes any content on AEM. I need to do it at the end of the publish workflow such that the servlet is hit only after all the approval processes are complete and AEM finally replicates the content to the publish instance.
I need to do it for all ways of publishing content in AEM. Some of the most common ways are shown below (using AEM 6.5)


We have tried adding our own replication agent under "Agents on author" as shown below:

Pointed the agent to our custom servlet and the servlet is being hit but there seems to be absolutely no way to determine the page path from where the author has initiated publish. We require the page path inside the servlet too.
Therefore the only way seems to be through Jquery where on clicking the publish button an ajax call is made to the servlet and we are able to capture the current page path this way. This approach is incorrect since the ajax call is independent of the inbuilt AEM publish workflow and the servlet will be called even if the page publish is rejected by any approvers in the workflow.
The correct way would be to call the servlet at the end of the default AEM replication/activation/publish workflow but we also need the path of the page which was published/activated which seems impossible. Is there any way to call our servlet during the default AEM activation flow?