Accessing HTTP parameters from a Confluence Web Item

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2017

Is there any way to access the underlying HTTP request when creating a web-panel. According to the documentation you need to extend a JIRA only class, which is clearly incorrect (and didn't compile).

The only class available for the context provider is com.atlassian.plugin.web.ContextProvider and

public Map<String, Object> getContextMap(Map<String, Object> context)

but this doesn't seem to have anything in the context which would let you figure out things like the HTTP request parameters.

I can't believe that web panels are fully featured in JIRA, but stunted in Confluence.

2 answers

0 votes
Aleksandr Zuevich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2017

Ok, how is your action described in atlassian-plugin.xml? You can use web-item and xwork elements and extends ConfluenceActionSupport in your action class. It'll allow you to invoke getCurrentRequest() method.

0 votes
Aleksandr Zuevich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2017

Hi Daniel,

try to use ServletActionContext.getRequest() to get the HttpServletRequest and then getParameter(paramName).

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2017

I thought of that as well, but ServletActionContext.getRequest() returns a null object.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events