July 2018
Intermediate to advanced
268 pages
7h 36m
English
We will implement a new HandlerFilterFunction, SampleHandlerFilterFunction, in which we will look at a path variable (pathVariable) and check for its value. If the value is equal to value2, we will mark the status as BAD_REQUEST. It's important to note that since HandlerFilterFunction applies only to functional-based, even though the path variable value is equal to value2, the status is not stamped as BAD_REQUEST, and the response received is OK:
public class SampleHandlerFilterFunction implements HandlerFilterFunction<ServerResponse, ServerResponse> { @Override public Mono<ServerResponse> filter(ServerRequest serverRequest, HandlerFunction<ServerResponse> handlerFunction) { if (serverRequest.pathVariable("pathVariable") ...Read now
Unlock full access