How to get the current pagepath in service

Avatar

Avatar

vijithar4145255

Avatar

vijithar4145255

vijithar4145255

08-02-2021

I have used the below code to get the currentpagepath in modal but if I use same code in service it is not working nd currentpage value I am getting null. Can anyone help on this.

 

@ScriptVariable
protected Page currentPage;

 

public string getCurrenPath() {

String currentPagePath = currentPage.getPath();

return currentPagePath;

}

View Entire Topic

Avatar

Avatar

KiranVedantam1992

Avatar

KiranVedantam1992

KiranVedantam1992

08-02-2021

Hi @vijithar4145255,

 

As per your comments, assuming you have request object, you can get the page URL like this:

Enumeration values = request.getHeaders(REFERER);

while (values.hasMoreElements()) {
pageURL = values.nextElement().toString();
}

Once you get the URL, you can trim it and fetch the path.

 

Hope this helps.

 

Thanks,

Kiran Vedantam.