public class

ServletFilterModuleDescriptor

extends BaseServletModuleDescriptor<T>
implements StateAware
java.lang.Object
   ↳ com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
     ↳ com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor<T>
       ↳ com.atlassian.plugin.servlet.descriptors.ServletFilterModuleDescriptor

Class Overview

A module descriptor that allows plugin developers to define servlet filters. Developers can define what urls the filter should be applied to by defining one or more <url-pattern> elements and they can decide where in the filter stack a plugin filter should go by defining the "location" and "weight" attributes.

The location attribute can have one of four values:
  • after-encoding - after the character encoding filter
  • before-login - before the login filter
  • before-decoration - before any global decoration like sitemesh
  • before-dispatch - before any dispatching filters or servlets

The default for the location attribute is "before-dispatch".

The weight attribute can have any integer value. Filters with lower values of the weight attribute will come before those with higher values within the same location.

Summary

Fields
public static final Comparator<ServletFilterModuleDescriptor> byWeight
[Expand]
Inherited Fields
From class com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
Public Constructors
ServletFilterModuleDescriptor(ModuleFactory moduleFactory, ServletModuleManager servletModuleManager)
Creates a descriptor that uses a module class factory to create instances.
Public Methods
void disabled()
Disables the module descriptor.
void enabled()
Enables the descriptor by loading the module class.
Set<FilterDispatcherCondition> getDispatcherConditions()
Returns a set of dispatcher conditions that have been set for this filter, these conditions will be one of the following: REQUEST, FORWARD, INCLUDE or ERROR.
FilterLocation getLocation()
Filter getModule()
The particular module object created by this plugin.
int getWeight()
void init(Plugin plugin, Element element)
Initialise a module given it's parent plugin and the XML element representing the module.
Protected Methods
void provideValidationRules(ValidationPattern pattern)
Provides validation rules for the pattern
[Expand]
Inherited Methods
From class com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
From class java.lang.Object
From interface com.atlassian.plugin.ModuleDescriptor
From interface com.atlassian.plugin.Resourced
From interface com.atlassian.plugin.StateAware

Fields

public static final Comparator<ServletFilterModuleDescriptor> byWeight

Public Constructors

public ServletFilterModuleDescriptor (ModuleFactory moduleFactory, ServletModuleManager servletModuleManager)

Creates a descriptor that uses a module class factory to create instances.

Parameters
moduleFactory The module factory
servletModuleManager The module manager

Public Methods

public void disabled ()

Disables the module descriptor. Classes overriding this method MUST call super.disabled() after their own disabling code.

public void enabled ()

Enables the descriptor by loading the module class. Classes overriding this method MUST call super.enabled() before their own enabling code.

public Set<FilterDispatcherCondition> getDispatcherConditions ()

Returns a set of dispatcher conditions that have been set for this filter, these conditions will be one of the following: REQUEST, FORWARD, INCLUDE or ERROR.

Returns
  • A set of dispatcher conditions that have been set for this filter.

public FilterLocation getLocation ()

public Filter getModule ()

The particular module object created by this plugin.

Returns
  • The module object created by this plugin.

public int getWeight ()

public void init (Plugin plugin, Element element)

Initialise a module given it's parent plugin and the XML element representing the module.

Since atlassian-plugins v2.2, you can no longer load classes from the plugin in this method, because the OSGi bundle that they will live in is not built yet. Load classes in the enabled() method instead.

Parameters
plugin The plugin that the module belongs to. Must not be null.
element XML element representing the module. Must not be null.

Protected Methods

protected void provideValidationRules (ValidationPattern pattern)

Provides validation rules for the pattern

Parameters
pattern The validation pattern