Servlet Plugin Module

JIRA Documentation

Index

Servlet plugin modules are implemented in the 3.5 Release. They are not available in previous releases.

 

Servlet plugin modules enable you to deploy Java servlets as a part of your plugins.

The Servlet Plugin Module

Each servlet is deployed as a plugin module of type "servlet". Here is an example atlassian-plugin.xml file containing a single servlet:

<atlassian-plugin name='Hello World Servlet' key='jira.plugin.helloworld'>
    <plugin-info>
        <description>A basic Servlet module test - says "Hello World!"</description>
        <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
        <version>1.0</version>
    </plugin-info>

    <servlet name='Hello World Servlet' key='helloWorld'
        class='com.atlassian.jira.plugin.helloworld.HelloWorldServlet'>
        <description>Says Hello World, Australia or your name.</description>
        <url-pattern>/helloworld</url-pattern>
        <init-param>
            <param-name>defaultName</param-name>
            <param-value>Australia</param-value>
        </init-param>
    </servlet>
</atlassian-plugin>
  • the class attribute of servlet is an subclass of javax.servlet.http.HttpServlet.
  • the url-pattern elements (one or more) define the locations this servlet will be accessed.
  • the init-param elements allow you to define initial parameters for your servlet, using the same method as you would normally in web.xml.

Accessing Your Servlet

You servlet will be accessed within the JIRA web application via each url-pattern you specify, beneath the /plugins/servlet parent path.

For example, if you specify a url-pattern of /helloworld as above, and your JIRA application was deployed at http://yourserver/jira - then your servlet would be accessed at http://yourserver/jira/plugins/servlet/helloworld .

Notes

Some information to be aware of when developing or configuring a servlet plugin module:

  • Your servlet's init() method will not be called on web application startup, as for a normal servlet. Instead, this method will be called the first time your servlet is accessed after each time it is enabled. This means that if you disable a plugin containing a servlet, or a single servlet module, and re-enable it again init() will be called again.
  • Because all servlet modules are deployed beneath a common /plugins/servlet root, be careful choosing each url-pattern under which your servlet is deployed. It is recommended to use a value that will always be unique to the world!

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.