Any way to get the refId in a sitemap from a URL string at valve level?


We know we can get the refId for a given request at valve level by doing


but that applies in the context of the the current request being processed.

What if I wanted to know the refId of another url that is not the one currently being processed by the valve, by having its url?

For instance, for the next request:

We would like to get the refId of the url passed in the targetUrl parameter, and NOT the one for the first part of the URL.

This gets particularly tricky as the targetUrl parameter could be in a sitemap that is defined in a configuration that is not the same where mypage is declared.

Asked more technically:

Is there any way to programmatically get all the sitemaps declared in all the configurations of my project and use a SitemapMatcher or similar to find the SiteMapItem that matches the targetUrl value so we can get the refId of THAT SiteMapItem?

Thanks in advance

See #matchSiteMapItem(..) in ResolvedMount (Hippo Site Toolkit API 14.6.0 API)

1 Like

Thanks for the quick response @woonsanko

valveContext.getRequestContext().getResolvedMount().matchSiteMapItem("THE_URL") would certainly give a SiteMapItem that matches the url passed as parameter (if found) and I can get the refId from that object.

Thanks a lot