From c8340009c42949321946d5d1993c3b01ef7ec7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20=C3=81lvarez=20=C3=81lvarez?= Date: Wed, 18 Sep 2024 16:08:56 +0200 Subject: [PATCH] Remove grizzly session handling code (delayed for a future PR) --- .../grizzly/GrizzlyDecorator.java | 11 ---------- .../src/test/groovy/GrizzlyAsyncTest.groovy | 18 ----------------- .../src/test/groovy/GrizzlyTest.groovy | 20 ------------------- 3 files changed, 49 deletions(-) diff --git a/dd-java-agent/instrumentation/grizzly-2/src/main/java/datadog/trace/instrumentation/grizzly/GrizzlyDecorator.java b/dd-java-agent/instrumentation/grizzly-2/src/main/java/datadog/trace/instrumentation/grizzly/GrizzlyDecorator.java index f5de074eb9b4..ecc3f5bd2239 100644 --- a/dd-java-agent/instrumentation/grizzly-2/src/main/java/datadog/trace/instrumentation/grizzly/GrizzlyDecorator.java +++ b/dd-java-agent/instrumentation/grizzly-2/src/main/java/datadog/trace/instrumentation/grizzly/GrizzlyDecorator.java @@ -60,17 +60,6 @@ protected int status(final Response containerResponse) { return containerResponse.getStatus(); } - @Override - protected String requestedSessionId(final Request request) { - final String requestedSessionId = request.getRequestedSessionId(); - if (requestedSessionId != null) { - return requestedSessionId; - } - // this forces the loading of the requested session id - request.getSession(false); - return request.getRequestedSessionId(); - } - @Override protected String[] instrumentationNames() { return new String[] {"grizzly"}; diff --git a/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyAsyncTest.groovy b/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyAsyncTest.groovy index e3e05c61f60e..1eb132a13ff7 100644 --- a/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyAsyncTest.groovy +++ b/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyAsyncTest.groovy @@ -1,5 +1,4 @@ import datadog.appsec.api.blocking.Blocking -import org.glassfish.grizzly.http.server.Request import javax.ws.rs.GET import javax.ws.rs.HeaderParam @@ -7,13 +6,11 @@ import javax.ws.rs.Path import javax.ws.rs.QueryParam import javax.ws.rs.container.AsyncResponse import javax.ws.rs.container.Suspended -import javax.ws.rs.core.Context import javax.ws.rs.core.Response import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.ERROR -import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.SESSION_ID import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.USER_BLOCK import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.EXCEPTION import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.FORWARDED @@ -124,20 +121,5 @@ class GrizzlyAsyncTest extends GrizzlyTest { } } } - - @GET - @Path("session") - Response session(@Context Request request, @Suspended AsyncResponse ar) { - executor.execute { - try { - controller(SESSION_ID) { - final session = request.getSession(true) - ar.resume(Response.status(SESSION_ID.status).entity(session.idInternal).build()) - } - } catch (Exception e) { - ar.resume(e) - } - } - } } } diff --git a/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyTest.groovy b/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyTest.groovy index 7e37bb44b51b..7ab2a10e26d0 100644 --- a/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyTest.groovy +++ b/dd-java-agent/instrumentation/grizzly-2/src/test/groovy/GrizzlyTest.groovy @@ -2,7 +2,6 @@ import datadog.appsec.api.blocking.Blocking import datadog.trace.agent.test.base.HttpServerTest import datadog.trace.instrumentation.grizzly.GrizzlyDecorator import org.glassfish.grizzly.http.server.HttpServer -import org.glassfish.grizzly.http.server.Request import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory import org.glassfish.jersey.server.ResourceConfig @@ -15,7 +14,6 @@ import javax.ws.rs.container.ContainerRequestContext import javax.ws.rs.container.ContainerRequestFilter import javax.ws.rs.container.ContainerResponseContext import javax.ws.rs.container.ContainerResponseFilter -import javax.ws.rs.core.Context import javax.ws.rs.core.Response import javax.ws.rs.ext.ExceptionMapper import javax.ws.rs.ext.Provider @@ -28,7 +26,6 @@ import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.QUERY_ import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.QUERY_ENCODED_QUERY import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.REDIRECT -import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.SESSION_ID import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.SUCCESS import static datadog.trace.agent.test.base.HttpServerTest.ServerEndpoint.USER_BLOCK @@ -116,11 +113,6 @@ class GrizzlyTest extends HttpServerTest { false } - @Override - boolean testSessionId() { - return true - } - static class SimpleExceptionMapper implements ExceptionMapper { @Override @@ -142,9 +134,6 @@ class GrizzlyTest extends HttpServerTest { @Path("/") static class ServiceResource { - @Context - Request request - @GET @Path("success") Response success() { @@ -220,15 +209,6 @@ class GrizzlyTest extends HttpServerTest { } return null } - - @GET - @Path("session") - Response session() { - controller(SESSION_ID) { - final session = request.getSession(true) - Response.status(SESSION_ID.status).entity(session.idInternal).build() - } - } } @Provider