From 663f47f22f243755d9ff0a808e97dcf19f525375 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 18 Jun 2021 11:48:47 +0300 Subject: [PATCH] Fix RESTEasy Reactive documentation on how to abort with @ServerRequestFilter Fixes: #17998 --- docs/src/main/asciidoc/resteasy-reactive.adoc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/resteasy-reactive.adoc b/docs/src/main/asciidoc/resteasy-reactive.adoc index 84351d97c669a..6cd383773b930 100644 --- a/docs/src/main/asciidoc/resteasy-reactive.adoc +++ b/docs/src/main/asciidoc/resteasy-reactive.adoc @@ -1169,6 +1169,8 @@ Request filters can be declared with the `@ServerRequestFilter` annotation: [source,java] ---- +import java.util.Optional; + class Filters { @ServerRequestFilter(preMatching = true) @@ -1180,11 +1182,12 @@ class Filters { } @ServerRequestFilter - public void getFilter(ContainerRequestContext ctx) { + public Optional getFilter(ContainerRequestContext ctx) { // only allow GET methods for now if(ctx.getMethod().equals(HttpMethod.GET)) { - ctx.abortWith(Response.status(Response.Status.METHOD_NOT_ALLOWED).build()); + return Optional.of(Response.status(Response.Status.METHOD_NOT_ALLOWED).build()); } + return Optional.empty(); } } ----