Getting all components on an Experience Page

Hi everybody,

How do I get access to all available components on an Experience Page?

With regular pages I was always able to fetch all components by getting the HstComponentConfiguration from the ResolvedSitemapItem as follows:

ResolvedSiteMapItem resolvedSiteMapItem = request.getRequestContext().getResolvedSiteMapItem();
    HstComponentConfiguration hstComponentConfiguration = resolvedSiteMapItem.getHstComponentConfiguration();

I could then get a hold of all available components on the current page.

With Experience Pages that doesn’t seem to work anymore. I simply get a null returned when calling resolvedSiteMapItem.getHstComponentConfiguration.

I get that the hst configuration has moved to the Document node that represents the Experience Page and might not qualify as hst configuration any more. However, can I get these components from somewhere else? Would I have to get them from the Exprience Page Document node? I simply can’t find this explained anywhere.

Thanks!

It should be possible to get the components from the xpage document yes. They sit under the hst:xpage node.

Hmmm, I think your code should’ve worked, but I can’t say I’ve tried it. But looking in the code for org.hippoecm.hst.site.request.ResolvedSiteMapItemImpl, it should return something. If it’s null, possibly you have the wrong sitemap item?

The strange thing is that the ResolvedSitemapItem also does not indicate that the this is in fact an Experience Page when I call resolvedSiteMapItem.isExperiencePage()

There might indeed be something wrong with my sitemap matching. I will investigate further.