如何在WebFlux中验证请求参数?
是否有任何建议使这段代码与使用JSR 303和RestControllers一样美观和简短?
public Mono<ServerResponse> getStatistic(ServerRequest request) {
Integer pageSize = request.queryParam(Constants.SIZE_PARAM)
.map(Integer::parseInt)
.filter(x -> x.compareTo(Constants.MAX_PAGE_SIZE) <= 0)
.orElseThrow(() -> new IllegalArgumentException("..."));
// ...
}