Get Suffix Path from requestPathInfo



I have this requirement where I have to download AEM Tags as a csv file. My Java code is fine and ready but I am stuck to get the initial Resource path i.e. the suffix from the url which only changes on page load, thus the request object changes on page load and not on click of a tag. e.g. http://localhost:4502/libs/cq/tagging/gui/content/tags.html/etc/tags/abc/xyz/abcxyz I would like to fetch /etc/tags/abc/xyz/abcxyz​ i.e. the suffix part on click and not on page load. How do I achieve this. I am using ${requestPathInfo.suffix}.download.csv to fetch the suffix path. I know I have to write a JS fetching the path but any help to this approach might be helpful.