Rate this page:
Atlassian Plugin Framework 2.1 and later.
The element was added in Plugin Framework 2.5.
Servlet Filter plugin modules allow you to deploy Java Servlet filters as a part of your plugin, specifying the location and ordering of your filter. This allows you to build filters that can tackle tasks like profiling and monitoring as well as content generation.
The root element for the Servlet Filter plugin module is . It allows the following attributes and child elements for configuration:
The class which implements this plugin module. The class you need to provide depends on the module type. For example, Confluence theme, layout and colour-scheme modules can use classes already provided in Confluence. So you can write a theme-plugin without any Java code. But for macro and listener modules you need to write your own implementing class and include it in your plugin. See the plugin framework guide to creating plugin module instances.
The servlet filter Java class must implement .
Indicate whether the plugin module should be disabled by default (value='disabled') or enabled by default (value='enabled').
|The localisation key for the human-readable name of the plugin module.|
In the example, is the key for this particular module declaration, for , in this case.I.e. the identifier of the servlet filter.
The position of the filter in the application's filter chain.
If two plugins provide filters at the same position, the 'weight' attribute (see below) is evaluated.
The human-readable name of the plugin module.
I.e. the human-readable name of the filter.
Default: the plugin key.
Indicates whether this plugin module is a system plugin module (value='true') or not (value='false'). Only available for non-OSGi plugins.
The weight of the filter, used to decide which order to place the filter in the chain for filters which have specified the same 'location' attribute (see above).
The higher weight, the lower the filter's position.Default: 100.
*key attribute is required.
The description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body. I.e. the description of the filter.
Initialisation parameters for the filter, specified using and sub-elements, just as in .
This element and its child elements may be repeated.
|A resource for this plugin module. This element may be repeated. A 'resource' is a non-Java file that a plugin may need in order to operate. Refer to Adding Resources to your Project for details on defining a resource.|
The pattern of the URL to match. This element may be repeated.
The URL pattern format is used in Atlassian plugin types to map them to URLs. On the whole, the pattern rules are consistent with those defined in the Servlet 2.3 API. The following wildcards are supported:
Determines when the filter is triggered. You can include multiple elements.
Note: This element is only available in Plugin Framework 2.5 and later.
Default: filter will be triggered only for requests from the client.
*url-pattern element is required.
Here is an example file containing a single servlet filter:
<atlassian-plugin name="Hello World Filter" key="example.plugin.helloworld" plugins-version="2"> <plugin-info> <description>A basic Servlet filter module test - says "Hello World!</description> <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/> <version>1.0</version> </plugin-info> <servlet-filter name="Hello World Servlet" key="helloWorld" class="com.example.myplugins.helloworld.HelloWorldFilter" location="before-dispatch" weight="200"> <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> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </servlet-filter> </atlassian-plugin>
Your servlet will be accessible within the Atlassian web application via each you specify, but unlike the Servlet Plugin Module, the is relative to the root of the web application.
Some information to be aware of when developing or configuring a Servlet Filter plugin module:
Rate this page: