Package org.jivesoftware.admin
Class PluginFilter
java.lang.Object
org.jivesoftware.admin.PluginFilter
- All Implemented Interfaces:
javax.servlet.Filter
A servlet filter that plugin classes can use to dynamically register and un-register filter logic.
This implementation assumes, but does not enforce, that filters installed by plugins are applied to URL patterns that
match the plugin. When filters installed by different plugins are applied to the same URL, the behavior of this
implementation is undetermined.
- Author:
- Matt Tucker, Guus der Kinderen, guus.der.kinderen@gmail.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPluginFilter(String filterUrl, javax.servlet.Filter filter) Adds a filter to the list of filters that will be run on every request of which the URL matches the URL that is registered with this filter.voiddestroy()voiddoFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) This class is a Filter implementation itself.voidinit(javax.servlet.FilterConfig filterConfig) static javax.servlet.FilterremovePluginFilter(String filterUrl, String filterClassName) Removes a filter that is applied to a certain URL.
-
Constructor Details
-
PluginFilter
public PluginFilter()
-
-
Method Details
-
addPluginFilter
Adds a filter to the list of filters that will be run on every request of which the URL matches the URL that is registered with this filter. More specifically, the request URL should be equal to, or start with, the filter URL. Multiple filters can be registered on the same URL, in which case they will be executed in the order in which they were added. Adding a filter does not initialize the plugin instance.- Parameters:
filterUrl- The URL pattern to which the filter is to be applied. Cannot be null nor an empty string.filter- The filter. Cannot be null.
-
removePluginFilter
Removes a filter that is applied to a certain URL. Removing a filter does not destroy the plugin instance.- Parameters:
filterUrl- The URL pattern to which the filter is applied. Cannot be null nor an empty string.filterClassName- The filter class name. Cannot be null or empty string.- Returns:
- The filter instance that was removed, or null if the URL and name combination did not match a filter.
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException - Specified by:
initin interfacejavax.servlet.Filter- Throws:
javax.servlet.ServletException
-
doFilter
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException This class is a Filter implementation itself. It acts as a dynamic proxy to filters that are registered by Openfire plugins.- Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
IOExceptionjavax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Filter
-