Confluence custom plugin action fails with 405 (Method Not Allowed)

Hi,

We upgraded to Confluence 9.2.2 and our custom plugin fails with 405 (Method Not Allowed) when we try and run it.
The plugin basically executes a rest api call for Scroll HTML Exporter where we do some customization to the content downloaded.
Upon clicking on the name of the action item to execute the plugin we are redirected to a Method Not Allowed page. It seems to almost fail at this method but there is no clear error:
@Override
public String execute() throws IOException {

    }

I had to change the version in my to 9.2.2 in the pom.xml so it could compile properly and changed to apache maven 3.9.9.
I cannot for the life of me figure out what is wrong.
Any help would be greatly appreciated.
The below error is from the console when inspecting the page:
/plugins/export-htmlV/export-htmlV.action?pageId=43626132:1

GET https://wiki2.xx.co.za/plugins/export-htmlV/export-htmlV.action?pageId=43626132 405 (Method Not Allowed)

Thanks.

I managed to fix the issue.

In the main class there is an execute() method which for some reason after upgrading to 9.2.2 stopped firing by default. I had to change it from execute() to doDefault() and then specify that method in the action line inside the atlassian-plugin.xml.
<action name=“export-htmlV” class=“com.xx.mis.plugins.impl.WikiPage” method=“doDefault”>

Hi @DanielHurrell. I have the exact same “Method Not Allowed” issue after installing a custom plugin in Confluence 9.2.4 (which worked perfectly in Confluence 8).

Unfortunately, I have two different actions (for view and save):

<action name="global-config-view" class="GlobalConfigAction" method="executeView">
<action name="global-config-save" class="GlobalConfigAction" method="executeSave">

And therefore also two Java methods executeView() and executeSave(). Now I’m confused on how I should try your suggested fix of using “doDefault” because I need two methonds, not one…

Hi @Dominik2, my knowledge with the custom plugin development for Confluence is very limited. What you could possibly try if its not a mission is to move the one method to another class and then just name them both to doDefault() and just reference the individual classes so it would look something like below:

Further than that, you may just have to play around with different method names without execute. Sorry I couldn’t be more help.

1 Like

Hi @DanielHurrell.

In the meantime, I already tried that and it worked!! I split my Action classes into two… both with an own doDefault() method.

Unfortunately, only my “view” actions are working… a .vm HTML form is correctly displayed when clicking on the Global configuration or the per-Space configuration of the plugin. However, clicking on the Save button that redirects to the “save” action keeps leading me to a 403 error. I added this line to the form which I found on the Form Token Handling page, but that didn’t help:

<input type="hidden" name="atl_token" value="$atl_token" />

Again, I’m out of ideas on how to get this Save Action working for Confluence 9, which worked fine in Confluence 8.

Hi @Dominik2, that’s progress at least.
Trust me, it took me much longer than it should have to fix the issue I had. I tried so many different things to get it to work but nothing did and then eventually, I came across a developer thread where someone posted their atlassian-plugin.xml and noticed they didn’t have an execute method only doDefault.
Good luck!

Hi @DanielHurrell

Can you please post that developer thread link if you’ve it ?

Thanks
Nishant

Hi @Nishantupadhyay,

I believe I saw the information here:

1 Like

Hi @Dominik2

Did you find any solution for this ?

Thanks
Nishant

Yes! The problem was not the methods name, but the access to them. I finally made it work like this:

<action name="global-config-view" class="GlobalConfigAction" method="executeView">
	<param name="permittedMethods">GET,POST</param>
	<param name="RequireSecurityToken">false</param>
	<result name="success" type="velocity">/templates/global-config.vm</result>
</action>
<action name="global-config-save" class="GlobalConfigAction" method="executeSave">
	<param name="permittedMethods">GET,POST</param>
	<param name="RequireSecurityToken">false</param>
	<result name="success" type="redirect">/admin/eadiagram/global-config-view.action</result>
</action>

Thanks @dominik2 for the quick response.

Actually I tried the same way as you mentioned . But for me , When I click on save button in my form, it is not passing the form values to Action class.

Do you have to make any changes in the .vm file for HTML form ?

Thanks
Nishant

No, I did not have to make any changes regarding this in the VM templates. They still rendered correctly like with Confluence 8, only somehow the access got stricter.