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 Summary
Modifier and TypeMethodDescriptionvoidhandle(MiddlewareCallbackInfo callbackInfo, BaseExchange exchange) Defines the logic of the middleware.default booleanisApplicable(BaseExchange exchange) Checks if themiddlewareis applicable of handling the specificexchange.default booleanisApplicable(Class<? extends Server> server) Checks if themiddlewareis applicable of handling the specificserversexchange.
-
Method Details
-
handle
Defines the logic of the middleware.- Parameters:
callbackInfo- Thecallback infothat is used to store data between middlewares.exchange- Theexchangethat holds the data of the request.
-
isApplicable
Checks if themiddlewareis applicable of handling the specificexchange.- Parameters:
exchange- Theexchangeto check.- Returns:
trueif the middleware can handle the exchange,falseotherwise.
-
isApplicable
Checks if themiddlewareis applicable of handling the specificserversexchange.- Parameters:
server- Theserverto check.- Returns:
trueif the middleware can handle the server,falseotherwise.
-