Bamboo: Result decorator in servlet

Hi,

I am writing a plugin which contains web-item and servlet.

<web-item key="key" name="webItem" section="chainResults.subMenu/chainResults" weight="60">

	<link linkId="link_to_servlet" absolute="false">/plugins/servlet/static?planKey=${planKey}&buildNumber=${buildNumber}</link>

</web-item>
<servlet name="Servlet" key="static-servlet" class="StaticServlet">
        <description>The My Servlet Plugin</description>
        <resource name="view" type="velocity" location="servlet.vm"/>
        <url-pattern>/static</url-pattern>
    </servlet>

public class StaticServlet extends HttpServlet{
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{
        response.setContentType("text/html;charset=utf-8");
        renderer.render("/servlet.vm", map, response.getWriter());
}
}
<html>
<head>
 <meta name="decorator" content="result">
</head>
<body>
...

When I am at Build summary or any other tab and click on web item, servlet has decorators and everything, but when I paste link to browser or reload servlet, there is an error (obviously).

Is there some way to process URL parameters "buildKey" and "buildNumber" so bamboo will know what decorator to use? I know how to do this in xwork but I want to use servlets for this task.

Thanks!

2 answers

1 accepted

This widget could not be displayed.

I have decided to use Xwork/actions. I wanted servlets because of velocity but I have no choice if I don't want to try random things for days.

This widget could not be displayed.

I sucesfully retrieve immutablePlan and resultsSummary and pass it to velocity template as parameters

map.put("immutablePlan", getImmutableChain());
map.put("resultsSummary", getResultsSummary());
renderer.render("/template.vm", mamap, response.getWriter());

I think I am on the right way. Now my problem is how to pass these to decorator, so he knows what project, plan and build I am in.

Any ideas?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

71 views 1 0
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