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 Filters, 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 Filters should first check if SecurityRealm.createFilter(FilterConfig) is more appropriate.

See Also:
  • Constructor Details

    • PluginServletFilter

      public PluginServletFilter()
  • Method Details

    • init

      public void init(jakarta.servlet.FilterConfig config) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.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 with removeFilter(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 public static boolean hasFilter(javax.servlet.Filter filter)
      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 interface jakarta.servlet.Filter
      Throws:
      IOException
      jakarta.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter
    • cleanUp

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void cleanUp()