Fetching current page URL in dialog dynamic drop down | Community
Skip to main content
Level 2
March 30, 2021
Solved

Fetching current page URL in dialog dynamic drop down

  • March 30, 2021
  • 2 replies
  • 1218 views

Hello,

 

I am working on aem 6.5

My requirement is to get current page URL in the dynamic drop down servlet.

Currently when I fetch request.getPath it is giving me location of the component in apps folder and not the page where component is added.

So I am trying to get /content/abc/home/jrc:content and fetch page propedties there. Since m not aware of the page location this is creating problem to do further work. Anyone faced similar problem? Kindly guide me.

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @kiranchonkar 

Can you check the referrer header in the request object and see what it returns?

final String referrer = request.getHeader(HttpHeaders.REFERER);

 

Thanks! 

2 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
March 30, 2021

Hi @kiranchonkar 

Can you check the referrer header in the request object and see what it returns?

final String referrer = request.getHeader(HttpHeaders.REFERER);

 

Thanks! 

Singaiah_Chintalapudi
Level 7
March 30, 2021

Try with either getServletPath() or getRequestUrl()/getRequestUri(). One of these should work.

Thanks,

Singaiah