@Test public void testMaxMDCValueLength_default() throws ServletException, IOException { this.testTarget = new AbstractMDCPutFilter() { @Override protected String getMDCKey(HttpServletRequest request, HttpServletResponse response) { return "key"; } @Override protected String getMDCValue(HttpServletRequest request, HttpServletResponse response) { return "12345678901234567890123456789012a"; } }; testTarget.doFilterInternal(mockRequest, mockResponse, mockFilterChain); assertThat(mockFilterChain.actualMdcPutValue, is( "12345678901234567890123456789012")); }
@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);  }