Class ServletFilterModuleDescriptor
java.lang.Object
com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor<javax.servlet.Filter>
com.atlassian.plugin.servlet.descriptors.ServletFilterModuleDescriptor
- All Implemented Interfaces:
ModuleDescriptor<javax.servlet.Filter>,Resourced,ScopeAware,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:
- 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 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
FieldsFields inherited from class com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor
logFields inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
key, moduleClass, moduleClassName, moduleFactory, name, plugin, resources -
Constructor Summary
ConstructorsConstructorDescriptionServletFilterModuleDescriptor(ModuleFactory moduleFactory, ServletModuleManager servletModuleManager) Creates a descriptor that uses a module class factory to create instances. -
Method Summary
Modifier and TypeMethodDescriptionvoiddisabled()voidenabled()protected booleanOverrides the base class's handling to allow usingASYNC_DEFAULT_SYSPROPto control whether filters are<async-supported/>by default or not.Deprecated.since 4.6.0.Set<javax.servlet.DispatcherType>Returns a set of dispatcher types that have been set for this filter.javax.servlet.Filterintvoidprotected voidMethods inherited from class com.atlassian.plugin.servlet.descriptors.BaseServletModuleDescriptor
getInitParams, getPaths, isAsyncSupportedMethods inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
assertModuleClassImplements, checkPermissions, destroy, equals, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getModuleClassName, getName, getParams, getPlugin, getPluginKey, getRequiredPermissions, getResourceDescriptor, getResourceDescriptors, getResourceLocation, getScopeKey, hashCode, isBroken, isEnabled, isEnabledByDefault, isSystemModule, loadClass, satisfiesMinJavaVersion, setBroken, setPlugin, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.atlassian.plugin.ModuleDescriptor
getDisplayName
-
Field Details
-
byWeight
-
-
Constructor Details
-
ServletFilterModuleDescriptor
public ServletFilterModuleDescriptor(ModuleFactory moduleFactory, ServletModuleManager servletModuleManager) Creates a descriptor that uses a module class factory to create instances.- Parameters:
moduleFactory- The module factoryservletModuleManager- The module manager- Since:
- 2.5.0
-
-
Method Details
-
init
- Specified by:
initin interfaceModuleDescriptor<javax.servlet.Filter>- Overrides:
initin classBaseServletModuleDescriptor<javax.servlet.Filter>
-
validate
- Overrides:
validatein classBaseServletModuleDescriptor<javax.servlet.Filter>
-
enabled
public void enabled()- Specified by:
enabledin interfaceStateAware- Overrides:
enabledin classAbstractModuleDescriptor<javax.servlet.Filter>
-
disabled
public void disabled()- Specified by:
disabledin interfaceStateAware- Overrides:
disabledin classAbstractModuleDescriptor<javax.servlet.Filter>
-
getModule
public javax.servlet.Filter getModule()- Specified by:
getModulein interfaceModuleDescriptor<javax.servlet.Filter>- Specified by:
getModulein classAbstractModuleDescriptor<javax.servlet.Filter>
-
getLocation
-
getWeight
public int getWeight() -
getDispatcherConditions
Deprecated.since 4.6.0. UsegetDispatcherTypes()instead.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
-
getDispatcherTypes
Returns a set of dispatcher types that have been set for this filter. These can be any of the values supported byDispatcherType.- Returns:
- A set of dispatcher types that have been set for this filter.
- Since:
- 4.6.0
-
getDefaultAsyncSupported
protected boolean getDefaultAsyncSupported()Overrides the base class's handling to allow usingASYNC_DEFAULT_SYSPROPto control whether filters are<async-supported/>by default or not.The servlet spec documents that filters do not support async unless they are explicitly marked otherwise, and so the default here is also
false. However, Tomcat'sServletContext.addFilter(java.lang.String, java.lang.String)implementation does not adhere to the spec and filters in Tomcat do support async unless they are explicitly set not to. The system property allows products to opt into Tomcat's behavior.- Overrides:
getDefaultAsyncSupportedin classBaseServletModuleDescriptor<javax.servlet.Filter>- Returns:
false, unlessASYNC_DEFAULT_SYSPROPhas been set to override it- Since:
- 5.8.0
-