How to: bamboo get resources defined within servlet

Assume the following servlet definition:

<servletname="Build My Servlet"



<description>Serves up build stuff</description>


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


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
Accepted answer

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

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
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

62 views 4 0
View post

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