Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to: bamboo get resources defined within servlet

Christopher Dancy
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.
December 19, 2012

Assume the following servlet definition:

<servletname="Build My Servlet"

key="myServlet"

class="com.whatever.MyServlet">

<description>Serves up build stuff</description>

<url-pattern>/MySummary</url-pattern>

<resource type="freemarker" name="edit"location="/templates/myServletTemplate.ftl"/>

</servlet>

From within the servlet class, and specifically the doGet method, how do I get ahold of that resources? I'd like to grab an instance of ModuleDescriptor somehow so that I can do something like the below but I can't seem to make anything work. Any suggestions would be great. Thanks.

ResourceLocation resourceLocation = moduleDescriptor.getResourceLocation("freemarker", "edit");

2 answers

1 accepted

0 votes
Answer accepted
Christopher Dancy
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.
January 30, 2013

I got around this (or rather I did it the "correct" way) by using xwork/action instead of creating custom servlet.

0 votes
James Dumay
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.
January 16, 2013

I don't believe its easy to get a servlets resource without knowing how the guts of the Atlassian Plugin framework works. Have you tried getting the resource by calling getClass().getresourceasstream('/templates/myServletTemplate.ftl')?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events