@Test public void testGetMDCValue_default_attributeName() throws ServletException { xTrackMDCPutFilter.init(mockFilterConfig); MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); String xTrack = xTrackMDCPutFilter.getMDCValue(request, response); assertThat(xTrack, is(notNullValue())); assertThat(xTrack.matches("^[a-f0-9]{32}$"), is(true)); assertThat(response.getHeader("X-Track"), is(xTrack)); assertThat((String) request.getAttribute("X-Track"), is(xTrack)); }
@Override protected String getMDCValue(HttpServletRequest request, HttpServletResponse response) { String xTrack = request.getHeader(attributeName); if (xTrack == null) { xTrack = createXTrack(); } String cutXTrack = cutValue(xTrack); response.setHeader(attributeName, cutXTrack); request.setAttribute(attributeName, cutXTrack); return cutXTrack; }
XTrackMDCPutFilter extends AbstractMDCPutFilter { @Override protected String getMDCValue(HttpServletRequest request, HttpServletResponse response) { String xTrack = request.getHeader(attributeName); if (xTrack == null) { xTrack = createXTrack(); } String cutXTrack = cutValue(xTrack); response.setHeader(attributeName, cutXTrack); request.setAttribute(attributeName, cutXTrack); return cutXTrack; } }
XTrackMDCPutFilter extends AbstractMDCPutFilter { @Override protected String getMDCValue(HttpServletRequest request, HttpServletResponse response) { String xTrack = request.getHeader(attributeName); if (xTrack == null) { xTrack = createXTrack(); } String cutXTrack = cutValue(xTrack); response.setHeader(attributeName, cutXTrack); request.setAttribute(attributeName, cutXTrack); return cutXTrack; }  }
XTrackMDCPutFilter extends AbstractMDCPutFilter { @Override protected String getMDCValue(HttpServletRequest request, HttpServletResponse response) { String xTrack = request.getHeader(attributeName); if (xTrack == null) { xTrack = createXTrack(); } String cutXTrack = cutValue(xTrack); response.setHeader(attributeName, cutXTrack); request.setAttribute(attributeName, cutXTrack); return cutXTrack; }  void setAttributeName(String attributeName); }
XTrackMDCPutFilter extends AbstractMDCPutFilter { @Override protected String getMDCValue(HttpServletRequest request, HttpServletResponse response) { String xTrack = request.getHeader(attributeName); if (xTrack == null) { xTrack = createXTrack(); } String cutXTrack = cutValue(xTrack); response.setHeader(attributeName, cutXTrack); request.setAttribute(attributeName, cutXTrack); return cutXTrack; }  void setAttributeName(String attributeName);  }