@Test public void shouldWriteInitTpicToResponse() { final HashMap<String, String> parsedInitValues = new HashMap<>(); parsedInitValues.put(INVOCATION_ID_KEY, "myGreatId321"); when(mockedBackend.copyToMap()).thenReturn(parsedInitValues); when(httpServletResponse.isCommitted()).thenReturn(false); unit.preHandle(httpServletRequest, httpServletResponse, new Object()); verify(httpServletResponse).setHeader(eq(TraceeConstants.TPIC_HEADER), contains(INVOCATION_ID_KEY + "=myGreatId321")); }
@Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o) { final TraceeFilterConfiguration configuration = backend.getConfiguration(profileName); if (configuration.shouldProcessContext(IncomingRequest)) { @SuppressWarnings("unchecked") final Enumeration<String> headers = request.getHeaders(incomingHeaderName); if (headers != null && headers.hasMoreElements()) { final Map<String, String> parsedContext = httpHeaderSerialization.parse(Collections.list(headers)); backend.putAll(configuration.filterDeniedParams(parsedContext, IncomingResponse)); } } Utilities.generateInvocationIdIfNecessary(backend); final HttpSession session = request.getSession(false); if (session != null) { Utilities.generateSessionIdIfNecessary(backend, session.getId()); } writeHeaderIfUncommitted(response); return true; }
TraceeInterceptor implements HandlerInterceptor { @Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o) { final TraceeFilterConfiguration configuration = backend.getConfiguration(profileName); if (configuration.shouldProcessContext(IncomingRequest)) { @SuppressWarnings("unchecked") final Enumeration<String> headers = request.getHeaders(incomingHeaderName); if (headers != null && headers.hasMoreElements()) { final Map<String, String> parsedContext = httpHeaderSerialization.parse(Collections.list(headers)); backend.putAll(configuration.filterDeniedParams(parsedContext, IncomingResponse)); } } Utilities.generateInvocationIdIfNecessary(backend); final HttpSession session = request.getSession(false); if (session != null) { Utilities.generateSessionIdIfNecessary(backend, session.getId()); } writeHeaderIfUncommitted(response); return true; } }
TraceeInterceptor implements HandlerInterceptor { @Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o) { final TraceeFilterConfiguration configuration = backend.getConfiguration(profileName); if (configuration.shouldProcessContext(IncomingRequest)) { @SuppressWarnings("unchecked") final Enumeration<String> headers = request.getHeaders(incomingHeaderName); if (headers != null && headers.hasMoreElements()) { final Map<String, String> parsedContext = httpHeaderSerialization.parse(Collections.list(headers)); backend.putAll(configuration.filterDeniedParams(parsedContext, IncomingResponse)); } } Utilities.generateInvocationIdIfNecessary(backend); final HttpSession session = request.getSession(false); if (session != null) { Utilities.generateSessionIdIfNecessary(backend, session.getId()); } writeHeaderIfUncommitted(response); return true; } TraceeInterceptor();  TraceeInterceptor(TraceeBackend backend); }
TraceeInterceptor implements HandlerInterceptor { @Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o) { final TraceeFilterConfiguration configuration = backend.getConfiguration(profileName); if (configuration.shouldProcessContext(IncomingRequest)) { @SuppressWarnings("unchecked") final Enumeration<String> headers = request.getHeaders(incomingHeaderName); if (headers != null && headers.hasMoreElements()) { final Map<String, String> parsedContext = httpHeaderSerialization.parse(Collections.list(headers)); backend.putAll(configuration.filterDeniedParams(parsedContext, IncomingResponse)); } } Utilities.generateInvocationIdIfNecessary(backend); final HttpSession session = request.getSession(false); if (session != null) { Utilities.generateSessionIdIfNecessary(backend, session.getId()); } writeHeaderIfUncommitted(response); return true; } TraceeInterceptor();  TraceeInterceptor(TraceeBackend backend); @Override boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o); @Override void postHandle(HttpServletRequest request, HttpServletResponse response, Object o, ModelAndView modelAndView); @Override void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object o, Exception e); void setOutgoingHeaderName(String outgoingHeaderName); void setIncomingHeaderName(String incomingHeaderName); String getProfileName(); void setProfileName(String profileName); }
TraceeInterceptor implements HandlerInterceptor { @Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o) { final TraceeFilterConfiguration configuration = backend.getConfiguration(profileName); if (configuration.shouldProcessContext(IncomingRequest)) { @SuppressWarnings("unchecked") final Enumeration<String> headers = request.getHeaders(incomingHeaderName); if (headers != null && headers.hasMoreElements()) { final Map<String, String> parsedContext = httpHeaderSerialization.parse(Collections.list(headers)); backend.putAll(configuration.filterDeniedParams(parsedContext, IncomingResponse)); } } Utilities.generateInvocationIdIfNecessary(backend); final HttpSession session = request.getSession(false); if (session != null) { Utilities.generateSessionIdIfNecessary(backend, session.getId()); } writeHeaderIfUncommitted(response); return true; } TraceeInterceptor();  TraceeInterceptor(TraceeBackend backend); @Override boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object o); @Override void postHandle(HttpServletRequest request, HttpServletResponse response, Object o, ModelAndView modelAndView); @Override void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object o, Exception e); void setOutgoingHeaderName(String outgoingHeaderName); void setIncomingHeaderName(String incomingHeaderName); String getProfileName(); void setProfileName(String profileName);  }