@Test public void testDoFilterInternal_leave_value() throws ServletException, IOException { MDC.put("dummyKey", "dummyValue"); testTarget.doFilterInternal(mockRequest, mockResponse, mockFilterChain); assertThat(MDC.getCopyOfContextMap().size(), is(2)); assertThat(MDC.get("dummyKey"), is("dummyValue")); assertThat(MDC.get("key"), is("value")); }
@Override protected final void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String key = getMDCKey(request, response); String value = getMDCValue(request, response); MDC.put(key, cutValue(value)); try { filterChain.doFilter(request, response); } finally { if (removeValue) { MDC.remove(key); } } }
AbstractMDCPutFilter extends OncePerRequestFilter { @Override protected final void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String key = getMDCKey(request, response); String value = getMDCValue(request, response); MDC.put(key, cutValue(value)); try { filterChain.doFilter(request, response); } finally { if (removeValue) { MDC.remove(key); } } } }
AbstractMDCPutFilter extends OncePerRequestFilter { @Override protected final void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String key = getMDCKey(request, response); String value = getMDCValue(request, response); MDC.put(key, cutValue(value)); try { filterChain.doFilter(request, response); } finally { if (removeValue) { MDC.remove(key); } } }  }
AbstractMDCPutFilter extends OncePerRequestFilter { @Override protected final void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String key = getMDCKey(request, response); String value = getMDCValue(request, response); MDC.put(key, cutValue(value)); try { filterChain.doFilter(request, response); } finally { if (removeValue) { MDC.remove(key); } } }  void setRemoveValue(boolean removeValue); void setMaxMDCValueLength(int maxMDCValueLength); }
AbstractMDCPutFilter extends OncePerRequestFilter { @Override protected final void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { String key = getMDCKey(request, response); String value = getMDCValue(request, response); MDC.put(key, cutValue(value)); try { filterChain.doFilter(request, response); } finally { if (removeValue) { MDC.remove(key); } } }  void setRemoveValue(boolean removeValue); void setMaxMDCValueLength(int maxMDCValueLength);  }