From 8a0913d4a2482cf315c2cd0fd4a254167278ddd9 Mon Sep 17 00:00:00 2001 From: Artur Souza Date: Fri, 11 Oct 2024 20:14:53 -0700 Subject: [PATCH] Fix license due to test dependency (#1143) --- sdk-tests/pom.xml | 7 ---- .../http/OpenTelemetryInterceptor.java | 35 ------------------- 2 files changed, 42 deletions(-) diff --git a/sdk-tests/pom.xml b/sdk-tests/pom.xml index 6ead6c307..6dff650ae 100644 --- a/sdk-tests/pom.xml +++ b/sdk-tests/pom.xml @@ -246,13 +246,6 @@ jakarta.servlet-api compile - - - javax.servlet - javax.servlet-api - 4.0.1 - compile - diff --git a/sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryInterceptor.java b/sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryInterceptor.java index 960dce888..f3fc496b2 100644 --- a/sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryInterceptor.java +++ b/sdk-tests/src/test/java/io/dapr/it/tracing/http/OpenTelemetryInterceptor.java @@ -67,39 +67,4 @@ public void postHandle( // There is no global context to be changed in post handle since it is done in preHandle on a new call. } - - // Implementation for springboot 3.0, which uses jakarta.servlet instead of javax.servlet - private static final TextMapGetter JAVA_HTTP_SERVLET_REQUEST_GETTER = - new TextMapGetter<>() { - @Override - public Iterable keys(javax.servlet.http.HttpServletRequest carrier) { - return Collections.list(carrier.getHeaderNames()); - } - - @Override - public String get(javax.servlet.http.HttpServletRequest carrier, String key) { - return carrier.getHeader(key); - } - }; - - public boolean preHandle( - javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) { - final TextMapPropagator textFormat = openTelemetry.getPropagators().getTextMapPropagator(); - // preHandle is called twice for asynchronous request. For more information, read: - // https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/AsyncHandlerInterceptor.html - if (request.getDispatcherType() == javax.servlet.DispatcherType.ASYNC) { - return true; - } - - Context context = textFormat.extract(Context.current(), request, JAVA_HTTP_SERVLET_REQUEST_GETTER); - request.setAttribute("opentelemetry-context", context); - return true; - } - - public void postHandle( - javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, - ModelAndView modelAndView) { - // There is no global context to be changed in post handle since it is done in preHandle on a new call. - } - }