Skip to content

Commit

Permalink
Remove grizzly session handling code (delayed for a future PR)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-alvarez-alvarez committed Sep 18, 2024
1 parent 23466e6 commit c834000
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import datadog.appsec.api.blocking.Blocking
import org.glassfish.grizzly.http.server.Request

import javax.ws.rs.GET
import javax.ws.rs.HeaderParam
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
Expand Down Expand Up @@ -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)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -116,11 +113,6 @@ class GrizzlyTest extends HttpServerTest<HttpServer> {
false
}

@Override
boolean testSessionId() {
return true
}

static class SimpleExceptionMapper implements ExceptionMapper<Throwable> {

@Override
Expand All @@ -142,9 +134,6 @@ class GrizzlyTest extends HttpServerTest<HttpServer> {
@Path("/")
static class ServiceResource {

@Context
Request request

@GET
@Path("success")
Response success() {
Expand Down Expand Up @@ -220,15 +209,6 @@ class GrizzlyTest extends HttpServerTest<HttpServer> {
}
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
Expand Down

0 comments on commit c834000

Please sign in to comment.