Atlassian Dev newbie here.
I'm trying to write my first Confluence Servlet Filter module. I want to be able to look up a page within my Filter code using the PageLocator classes. Currently, I have things hardcoded to get my feet wet. I'm certain the space and title exist, but getPage() always throws NullPointerException. I also tried the IDPageLocater – I'm certain the pageID I'm using exists.
DefaultPageManager pageManager = new DefaultPageManager();
TitleAndSpaceKeyPageLocator pageLocator = new TitleAndSpaceKeyPageLocator(pageManager, "~admin","Test Page 1");
//IdPageLocator pageLocator = new IdPageLocator(pageManager, 1474562);
Page page = pageLocator.getPage(); //always throws NullPointerException
Any suggestions are appreciated.
Community moderators have prevented the ability to post new answers.
Why not use the PageManager module?
private final PageManager pm; // init pm in the constructor Page p = pm.getPage(context.getSpaceKey(), context.getPageContext().getPageTitle());
will get you the current page your macro is executing in now, for example.
Have a look here
I tried using PageManager earlier with the same result. I wasn't using Construction-based injection (https://developer.atlassian.com/confdev/confluence-plugin-guide/writing-confluence-plugins/accessing-confluence-components-from-plugin-modules). Thanks for leading me to the answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.