Skip to content

Commit

Permalink
Fix RESTEasy Reactive documentation on how to abort with @ServerReque…
Browse files Browse the repository at this point in the history
…stFilter

Fixes: quarkusio#17998
  • Loading branch information
geoand committed Jun 18, 2021
1 parent d4a513e commit 663f47f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/src/main/asciidoc/resteasy-reactive.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,8 @@ Request filters can be declared with the `@ServerRequestFilter` annotation:

[source,java]
----
import java.util.Optional;
class Filters {
@ServerRequestFilter(preMatching = true)
Expand All @@ -1180,11 +1182,12 @@ class Filters {
}
@ServerRequestFilter
public void getFilter(ContainerRequestContext ctx) {
public Optional<Response> 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();
}
}
----
Expand Down

0 comments on commit 663f47f

Please sign in to comment.