Class Filters

java.lang.Object
io.quarkus.vertx.http.runtime.filters.Filters

public class Filters extends Object
Object allowing the register filters, i.e. handler called on every HTTP request. This object is intended to be used as follows:
 
 public void init(@Observes Filters filters) {
     filters.register(rc -> {
         // Do something before the next filter or route
         rc.next();
         // Do something after
     }, 10);
 }
 
 

The handler is the filter code. It must call RoutingContext.next() to invoke the next filter or route. The priority is used to sort the filters. Highest priorities are called first.

  • Constructor Details

    • Filters

      public Filters()
  • Method Details

    • register

      public Filters register(io.vertx.core.Handler<io.vertx.ext.web.RoutingContext> handler, int priority)
      Registers a new filter.
      Parameters:
      handler - the filter function, must not be null
      priority - the priority, must not be negative
      Returns:
      this object to chain registration.
    • getFilters

      public List<Filter> getFilters()
      Returns:
      the list of currently registered filters.