Getting currentPage from Experience Fragment with Apache Sling Dynamic Include enabled

27 Views Asked by At

When trying to get currentPage in experience fragment via dispatcher I'm always receiving the resourcePage. When trying to access currentPage directly on author/publish environment I'm getting expected results - the page that contains the experience fragment.

I tried the standard approach with @Inject Page currentPage, but it breaks when reaching for the page via dispatcher and returns the same result as resourcePage. request does not contain anything worth mentioning.

Edit: I figured out that caused this: Apache Sling Dynamic Include.

Right now my only solution is to get pathInfo from the request, convert it to path and find it to page using PageManager. There should a simpler way I cannot see.

0

There are 0 best solutions below