Package hudson.util
Class PluginServletFilter
java.lang.Object
hudson.util.PluginServletFilter
- All Implemented Interfaces:
ExtensionPoint
,jakarta.servlet.Filter
,org.kohsuke.stapler.CompatibleFilter
public final class PluginServletFilter
extends Object
implements org.kohsuke.stapler.CompatibleFilter, ExtensionPoint
Servlet
Filter
that chains multiple Filter
s, provided by plugins
While this class by itself is not an extension point, I'm marking this class as an extension point so that this class will be more discoverable.
SecurityRealm
that wants to contribute Filter
s should first
check if SecurityRealm.createFilter(FilterConfig)
is more appropriate.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addFilter
(jakarta.servlet.Filter filter) Dynamically register a new filter.static void
addFilter
(javax.servlet.Filter filter) Deprecated.static void
cleanUp()
void
destroy()
void
doFilter
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) static boolean
hasFilter
(jakarta.servlet.Filter filter) Checks whether the given filter is already registered in the chain.static boolean
hasFilter
(javax.servlet.Filter filter) Deprecated.void
init
(jakarta.servlet.FilterConfig config) static void
removeFilter
(jakarta.servlet.Filter filter) static void
removeFilter
(javax.servlet.Filter filter) Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.kohsuke.stapler.CompatibleFilter
doFilter, init
-
Constructor Details
-
PluginServletFilter
public PluginServletFilter()
-
-
Method Details
-
init
public void init(jakarta.servlet.FilterConfig config) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Filter
- Throws:
jakarta.servlet.ServletException
-
addFilter
public static void addFilter(jakarta.servlet.Filter filter) throws jakarta.servlet.ServletException Dynamically register a new filter. May be paired withremoveFilter(jakarta.servlet.Filter)
.For most purposes you can instead use
HttpServletFilter
.- Throws:
jakarta.servlet.ServletException
- Since:
- 2.475
-
addFilter
@Deprecated public static void addFilter(javax.servlet.Filter filter) throws javax.servlet.ServletException Deprecated.- Throws:
javax.servlet.ServletException
-
hasFilter
public static boolean hasFilter(jakarta.servlet.Filter filter) Checks whether the given filter is already registered in the chain.- Parameters:
filter
- the filter to check.- Returns:
- true if the filter is already registered in the chain.
- Since:
- 2.475
-
hasFilter
Deprecated.- Since:
- 2.94
-
removeFilter
public static void removeFilter(jakarta.servlet.Filter filter) throws jakarta.servlet.ServletException - Throws:
jakarta.servlet.ServletException
- Since:
- 2.475
-
removeFilter
@Deprecated public static void removeFilter(javax.servlet.Filter filter) throws javax.servlet.ServletException Deprecated.- Throws:
javax.servlet.ServletException
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilter
in interfacejakarta.servlet.Filter
- Throws:
IOException
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Filter
-
cleanUp
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void cleanUp()
-
addFilter(Filter)