Created
October 26, 2020 21:10
-
-
Save NutterzUK/09292525c3d19f3096b321f697dea83e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class MDCFilter extends OncePerRequestFilter { | |
@Override | |
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) | |
throws ServletException, IOException { | |
MDC.put("tracking", request.getHeader("tracking-header")); | |
try { | |
filterChain.doFilter(request, response); | |
} finally { | |
MDC.clear(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment