Hi All,
If we were to retrieve currentPage via activate method[seen below] , we can directly use getCurrentPage() and get it. However, in case I am not using this and also cannot pass getCurrentPage() from the java class where activate method is present , how do I get 'currentPage'?
@Override
public void activate() throws Exception {}
Any thoughts on this will be helpful.
Solved! Go to Solution.
Views
Replies
Total Likes
Activate method is for classes implementing WCMuse interface in sightly.
You can use sling model or simple resource resolver
Page mycurrentPage = request.getResource().adaptTo(Page.class)
Views
Replies
Total Likes
Activate method is for classes implementing WCMuse interface in sightly.
You can use sling model or simple resource resolver
Page mycurrentPage = request.getResource().adaptTo(Page.class)
Views
Replies
Total Likes
Hi Praveen,
Thanks a lot for your reply.
In my java code, I tried the below :
private static SlingHttpServletRequest slingRequest;
Page mycurrentPage = slingRequest.getResource().adaptTo(Page.class);
but the code is breaking after running this line and not going further.
Not sure what I am doing wrong.
Views
Replies
Total Likes
'mycurrentPage' is object of class Page
Now you use any of the specified method available here in https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/api/Page.html
Please share the exception or code snippet
Views
Replies
Total Likes
Hi Reply,
Thank you for your reply.It helped.
Views
Replies
Total Likes