How to get current page id inside java class implementing web item?


#1

Hello!

I have a class that implements web item in Confluence.

To get the necessary information for the web item, I need the information of the current page where the web item is displayed (ID, or title). It is easy for teh class implementing Macro as there is ConversionContet for this, but for my class using of ConversionContext seems to be not possible.

Is there any class/interface to get current page info.

Using of PageManager is not possible, as to retrieve the current page with PageManager you need to get its ID first.

Could you please help to understand how to retrieve the ID of the current page where web item is currently displayed for the java class implementing web item?

Thank you


#2

Hi, according to the documentation (https://developer.atlassian.com/server/framework/atlassian-sdk/web-item-plugin-module/) web item allow you to define new links in application menus. So it is the reason why there no current page is provided. In the definition of a web item you usually specifies where do you want to place a menu item, a link to an action when a user clicking on it.
I guess that you try to do something that web item is not designed for which is usually quite difficult . If I was you, I may consider to use macro to achieve the same goal.


#3

@huyle Yes, this is really so. Just was too quick with trying to get resolution, but had to think more on what is needed.
Thank you for the comment!