Class QuarkusRequestFilter

java.lang.Object
org.keycloak.quarkus.runtime.integration.web.QuarkusRequestFilter
All Implemented Interfaces:
io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>, TransactionalSessionHandler

public class QuarkusRequestFilter extends Object implements io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>, TransactionalSessionHandler

This filter is responsible for managing the request lifecycle as well as setting up the necessary context to process incoming requests. We need this filter running on the top of the chain in order to push contextual objects before executing Resteasy. It is not possible to use a ContainerRequestFilter for this purpose because some mechanisms like error handling will not be able to access these contextual objects.

The filter itself runs in an event loop and should delegate to worker threads any blocking code (for now, all requests are handled as blocking).

Note that this filter is only responsible to close the KeycloakSession if not already closed when running Resteasy code. The reason is that closing it should be done at the Resteasy level so that we don't block event loop threads even if they execute in a worker thread. Vert.x handlers and their callbacks are not designed to run blocking code. If the session is eventually closed here is because Resteasy was not executed.

See Also:
  • Constructor Details

    • QuarkusRequestFilter

      public QuarkusRequestFilter()
    • QuarkusRequestFilter

      public QuarkusRequestFilter(Predicate<io.vertx.ext.web.RoutingContext> contextFilter, ExecutorService executor)
  • Method Details

    • handle

      public void handle(io.vertx.ext.web.RoutingContext context)
      Specified by:
      handle in interface io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>