Confluence Servlet plugin module

I am trying to build a confluence servlet plugin module. I have put the javascript and css code in the generated files after running:

atlas-create-confluence-plugin

My question is where does the container expect to find the <ARTIFACT-ID>.js and <ARTIFACT-ID>.css files?

More specifically in the servlet code how do I construct the:

&lt;script type='' src=''&gt;&lt;/script&gt; &lt;link rel='' href='&gt;

so that the running servlet can find them. Or are they not required since their paths are already in the plugin descriptor?

1 answer

1 accepted

This widget could not be displayed.
David Simpson Community Champion Mar 18, 2014

In atlassian-plugin.xml you have something like this:

&lt;web-resource key="my-web-resources" name=" Web Resource"&gt;
		&lt;resource name="list.js" type="download" location="js/list.js"/&gt;
		&lt;resource name="list.css" type="download" location="css/list.css"/&gt;
		&lt;resource name="images/" type="download" location="images"/&gt;
	&lt;/web-resource&gt;

In your servlet template, add...

#requireResource("com.example.confluence.plugin.plugin-artifact-id:my-web-resources")

...where in your pom.xml groupId is com.example.confluence.plugin and artifactId is plugin-artifact-id.

This will inject your JS & CSS in the correct place in the header.

This assumes that you're using velocity templates in your servlet code, just like the generated LicenseServlet.

I do not fully understand how to use velocity templates yet. This is a Calendar plugin that was a stand-alone web-app and I am currently trying to get it to run as a servlet plugin.

So one follow-up question would be, are there any velocity template functions that generate tables?

Second, If I use the current html print statements, how do I construct manually, what would be injected in the header?

Is it possible to upload screenshots to the forum?

David Simpson Community Champion Mar 19, 2014

If you run atlas-create-confluence-plugin-module and then select Licensing API support from the list, it will produce a fully working servlet which uses velocity for tyhe HTML layout. That should give you a kick-start with example code.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

481 views 3 17
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