Package chapters.mdc

Class UserServletFilter

java.lang.Object
chapters.mdc.UserServletFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class UserServletFilter extends Object implements jakarta.servlet.Filter
A simple servlet filter that puts the username found either in the Principal.

The value is removed from the MDC once the request has been fully processed.

Author:
Sébastien Pennec
  • Constructor Details

  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter
    • 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
    • init

      public void init(jakarta.servlet.FilterConfig arg0) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Filter
      Throws:
      jakarta.servlet.ServletException