How to link a web-item to a servlet rendering soy template to show up in repository settings?

I am using latest bitbucket server and trying to add some configuration form to repository settings page under add-ons section. This configuration is specific for each repository. I was able to add a web-tem which shows up as a link under add-ons in repository settings. Now i would like link this web-item to a servlet to render the configuration page (built using soy template). when my link is clicked, It shows up a 404. I couldn't find any doc related to this configuration.

1. What is the <link> value that i should be using to invoke my servlet? Here is what i am using.

<web-item name="My Configuration Tab" key="My-configuration-tab" section="bitbucket.repository.settings.panel/repository-settings-addons-section">
<label key="My Configuration">My Configuration</label>
<link linkId="My-configuration-tab-link">/projects/${project.key}/repos/${repository.slug}/settings/configservlet</link>
<tooltip key="My-configuration-tab.tooltip">My Configuration</tooltip>

2. What is the corresponding url-pattern i should be using ? Here's what i have

<servlet name="My Config Servlet Module" i18n-name-key="" key="my-config-servlet" class="">
<description key="my-config-servlet.description">The My Config Servlet Plugin</description>

3. What is the meta tag that i should be using in soy template? Here's what i have

<meta name="decorator" content="bitbucket.repository.settings">

Other than above 3, are there any other things i need to have to get this working?

2 answers

1 accepted

0 votes
Answer accepted
Daniel Wester Community Champion Oct 22, 2017

You’re using a servlet so the path to it rooted at /plugins/servlet

so the link should be:


It is still giving the 404 error. I tried this.

1. Inside web-item i gave this link path

<link linkId="my-configuration-tab-link">/plugins/servlet/settings/configservlet</link>


2. Inside the servlet i gave the below path.



Did i miss anything? does the above path in <link> links to repository settings? What is the best way to debug this?

Thanks for the help.

Daniel Wester Community Champion Oct 23, 2017

Make the url-pattern in the servlet be:



By specifying



-the actual url pattern is /plugins/servlet/*/settings/configservlet

 - which you probably don't want :)


The other piece I would suggest is to have your add-on name in the url-pattern somewhere to avoid another add-on collding with your paths ( for example I try to have the Wittified add-ons at /wittified/....). This way likelihood of somebody else having the same path is a lot smaller :)

Thanks Daniel. that worked. In addition to the above one, i had to make few more changes in my soy template and in the servlet.

- I have added the necessary meta tags required for the repository settings decorater in the soy template.

<meta name="decorator" content="bitbucket.repository.settings">
<meta name="projectKey" content="{$repository.project.key}">
<meta name="repositorySlug" content="{$repository.slug}">

- I have declared the repository param in the soy template.

* @param repository Repository object

- I have passed in the project and repository names as part of the <link> tag and used those inside my servlet to get a repository instance like this and passed it on to the renderer.

<link linkId="my-configuration-tab-link">/plugins/servlet/settings/myconfig/${project.key}/${repository.slug}</link>
String pathInfo = req.getPathInfo();
String[] path = pathInfo.split("/");
String project = path[path.length-2];
String repo = path[path.length-1];
Repository repository = repositoryService.getBySlug(project, repo);


Hope this info helps someone with similar needs.

0 votes
Aleksandr Zuevich Community Champion Oct 20, 2017


Try to use 


Sorry that didn't wok.  it still gives 404. I was building on top of decorator-plugin example. if i use the <link> , <url-pattern>, <meta> tags from that example it works but opens in user accounts section.  Any other suggestions?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Thursday in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

220 views 0 12
Read article

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