Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Get dispatcher url from code

Avatar

Level 4

Hi Team

 

I want to get dispatcher url so that I can perfrom url splitting and get titles.

 

Currently when I try with below I am getting author /content urls even on publisher and dispatcher getting /content urls.

 

getCurrentPage().getPath()
this.getUrl()
 
Is there any way to get the dispatcher url.
 
Please advise
 
Thanks and Regards
Prashanthi
 
 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Prashardan, You need to configure Resource Mapping (/etc/map) for your website first. Then use the following Java code for Dispatcher URL:

 

String contentPath = getCurrentPage().getPath();
String mappedURL = getResourceResolver().map(contentPath); // Dispatcher URL

 

 

 

In Page Properties, 3 options are available. Please choose the method based on your requirement.

Screenshot 2023-07-22 at 1.48.40 AM.png

Mahedi Sabuj

MS-29LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @Prashardan, You need to configure Resource Mapping (/etc/map) for your website first. Then use the following Java code for Dispatcher URL:

 

String contentPath = getCurrentPage().getPath();
String mappedURL = getResourceResolver().map(contentPath); // Dispatcher URL

 

 

 

In Page Properties, 3 options are available. Please choose the method based on your requirement.

Screenshot 2023-07-22 at 1.48.40 AM.png

Mahedi Sabuj

MS-29LinkedIn

Avatar

Community Advisor

To get page title you can directly work with currentPage.getPageTitle() or currebtPage.getTitle() you don’t need to have dispatcher url. It will work for both author and publisher url.

and if you really need the dispatcher url then you can work with resourceresolver.map() to get the dispatcher url