Skip to content

Commit

Permalink
Merge pull request quarkusio#17999 from geoand/quarkusio#17998
Browse files Browse the repository at this point in the history
Fix RESTEasy Reactive documentation on how to abort with @ServerRequestFilter
  • Loading branch information
geoand authored Jun 21, 2021
2 parents 2efd95a + 663f47f commit c173219
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 c173219

Please sign in to comment.