How to use GeneralUtil in atlassian-plugin.xml


I was mimicing the Confluence Space IA plugin to create a space admin button in our template.

the line:

<link id="spacebar-settings-link">/spaces/spacetools.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>

the final render doesn't seem to render correctly, I see the string literal instead of the actual space key.

What am I missing? I didn't see anything obvious in the atlassian-plugin.xml, and I couldn't find a help page outlining the usage.


6 answers

1 accepted

0 votes
Accepted answer

So it turned out the $helper is not a accessible by default object.

I ened up with:


thanks all for the suggestions.

You've put the generalUtil in velocity context?

The best way to do that is bring the $helper.spaceKey already encoded to the velocity template.

with Confluence, GeneralUtil is always in the velocity context. it's one of the default objects.

When you say 'I see the string literal' do you mean that you see '$helper.spaceKey' in the output?



This was close, but it was the $helper object that was null. I ended up using:


I guess I saw the helper so much I thought it was there by default.

@David Pinn, Yep. But I found my way around it.

I discovered that in JIRA, JiraWebActionSupport has method urlEncode, thus I could just do the following in my Velocity template:


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,180 views 70 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you