com.atlassian.plugin.servlet.descriptors
Class ServletFilterModuleDescriptor

java.lang.Object
  extended by com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
      extended by com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor<javax.servlet.Filter>
          extended by com.atlassian.plugin.servlet.descriptors.ServletFilterModuleDescriptor
All Implemented Interfaces:
ModuleDescriptor<javax.servlet.Filter>, Resourced, StateAware

public class ServletFilterModuleDescriptor
extends BaseServletModuleDescriptor<javax.servlet.Filter>
implements StateAware

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:

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.

Since:
2.1.0

Field Summary
static Comparator<ServletFilterModuleDescriptor> byWeight
           
 
Fields inherited from class com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor
log
 
Fields inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
moduleClass, moduleClassName, moduleFactory, plugin, resources, singleton
 
Constructor Summary
ServletFilterModuleDescriptor(ModuleFactory moduleFactory, ServletModuleManager servletModuleManager)
          Creates a descriptor that uses a module class factory to create instances.
 
Method Summary
 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()
           
 javax.servlet.Filter getModule()
          The particular module object created by this plugin.
 int getWeight()
           
 void init(Plugin plugin, org.dom4j.Element element)
          Initialise a module given it's parent plugin and the XML element representing the module.
protected  void provideValidationRules(ValidationPattern pattern)
          Provides validation rules for the pattern
 
Methods inherited from class com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor
getInitParams, getPaths
 
Methods inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
assertModuleClassImplements, destroy, equals, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getName, getParams, getPlugin, getPluginKey, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, hashCode, isEnabledByDefault, isSingleton, isSingletonByDefault, isSystemModule, loadClass, loadClass, satisfiesMinJavaVersion, setPlugin, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

byWeight

public static final Comparator<ServletFilterModuleDescriptor> byWeight
Constructor Detail

ServletFilterModuleDescriptor

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
Since:
2.5.0
Method Detail

init

public void init(Plugin plugin,
                 org.dom4j.Element element)
          throws PluginParseException
Description copied from interface: ModuleDescriptor
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 AbstractModuleDescriptor.enabled() method instead.

Specified by:
init in interface ModuleDescriptor<javax.servlet.Filter>
Overrides:
init in class BaseServletModuleDescriptor<javax.servlet.Filter>
Parameters:
plugin - The plugin that the module belongs to. Must not be null.
element - XML element representing the module. Must not be null.
Throws:
PluginParseException - Can be thrown if an error occurs while parsing the XML element.

provideValidationRules

protected void provideValidationRules(ValidationPattern pattern)
Description copied from class: AbstractModuleDescriptor
Provides validation rules for the pattern

Overrides:
provideValidationRules in class BaseServletModuleDescriptor<javax.servlet.Filter>
Parameters:
pattern - The validation pattern

enabled

public void enabled()
Description copied from class: AbstractModuleDescriptor
Enables the descriptor by loading the module class. Classes overriding this method MUST call super.enabled() before their own enabling code.

Specified by:
enabled in interface StateAware
Overrides:
enabled in class AbstractModuleDescriptor<javax.servlet.Filter>

disabled

public void disabled()
Description copied from class: AbstractModuleDescriptor
Disables the module descriptor. Classes overriding this method MUST call super.disabled() after their own disabling code.

Specified by:
disabled in interface StateAware
Overrides:
disabled in class AbstractModuleDescriptor<javax.servlet.Filter>

getModule

public javax.servlet.Filter getModule()
Description copied from interface: ModuleDescriptor
The particular module object created by this plugin.

Specified by:
getModule in interface ModuleDescriptor<javax.servlet.Filter>
Specified by:
getModule in class AbstractModuleDescriptor<javax.servlet.Filter>
Returns:
The module object created by this plugin.
See Also:
ModuleDescriptor.getModuleClass()

getLocation

public FilterLocation getLocation()

getWeight

public int getWeight()

getDispatcherConditions

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.
Since:
2.5.0


Copyright © 2013 Atlassian. All Rights Reserved.