Interface Middleware

All Known Subinterfaces:
HttpMiddleware, WebsocketMiddleware

public interface Middleware
Represents a basic middleware that can be used in context with exchanges to manipulate the behaviour of the application without interacting with the built-in listener system.
Since:
3.4.0-SNAPSHOT
See Also:
  • Method Details

    • handle

      void handle(MiddlewareCallbackInfo callbackInfo, BaseExchange exchange)
      Defines the logic of the middleware.
      Parameters:
      callbackInfo - The callback info that is used to store data between middlewares.
      exchange - The exchange that holds the data of the request.
    • isApplicable

      default boolean isApplicable(BaseExchange exchange)
      Checks if the middleware is applicable of handling the specific exchange.
      Parameters:
      exchange - The exchange to check.
      Returns:
      true if the middleware can handle the exchange, false otherwise.
    • isApplicable

      default boolean isApplicable(Class<? extends Server> server)
      Checks if the middleware is applicable of handling the specific servers exchange.
      Parameters:
      server - The server to check.
      Returns:
      true if the middleware can handle the server, false otherwise.