Is it possible to get a reference to the vanity URL used after redirection?

倖福魔咒の 提交于 2019-12-12 03:17:27

问题


I have a page http://localhost:4502/content/project/en/mypage.html and it has couple of vanity URLs set as

/content/project/vanity-1
/content/project/vanity-2

So any request from the above two vanity URLs are being redirected to /mypage.html.

Is it possible to get the vanity URL request from where the page is redirected to? i.e how can I find from which vanity URL the request is coming from?

request.getRequestURL() gives me ../mypage.html but I need to get the vanity URL request.


回答1:


You should try to get it from /content/project/page/jcr:content properties sling:vanityPath




回答2:


It's available in the HTTP referer header. You can get it as follows:

String referrer = request.getHeader("referer"); 


来源:https://stackoverflow.com/questions/26680812/is-it-possible-to-get-a-reference-to-the-vanity-url-used-after-redirection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!