Skip to content

Commit 7cec944

Browse files
committed
Improve documentation: jakarta servlet types are only supported in a resteasy classic stack.
1 parent 62421d0 commit 7cec944

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/src/main/asciidoc/spring-web.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,11 @@ In addition to the method parameters that can be annotated with the appropriate
446446
`jakarta.servlet.http.HttpServletRequest` and `jakarta.servlet.http.HttpServletResponse` are also supported.
447447
For this to function however, users need to add the `quarkus-undertow` dependency.
448448

449+
⚠️ Important: These types are only available when using the Classic RESTEasy stack (quarkus-resteasy / quarkus-resteasy-jackson) because they rely on the Servlet API provided by Undertow (quarkus-undertow).
450+
451+
If your application uses the Reactive stack (quarkus-rest / quarkus-rest-jackson), then the Servlet API is not supported.
452+
In this case, adding the quarkus-undertow dependency will not enable servlet injection and will result in runtime errors.
453+
449454
=== Exception handler method return types
450455

451456
The following method return types are supported:

extensions/spring-web/resteasy-classic/tests/src/test/java/io/quarkus/spring/web/resteasy/classic/test/ResponseStatusAndExceptionHandlerTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import static io.restassured.RestAssured.when;
44

5+
import jakarta.servlet.http.HttpServletRequest;
6+
57
import org.junit.jupiter.api.Test;
68
import org.junit.jupiter.api.extension.RegisterExtension;
79
import org.springframework.http.HttpStatus;
@@ -47,5 +49,10 @@ public static class RestExceptionHandler {
4749
public ResponseEntity<Object> handleException(Exception ex) {
4850
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
4951
}
52+
53+
@ExceptionHandler(RuntimeException.class)
54+
public ResponseEntity<Object> forbidden(Exception ex, HttpServletRequest request) {
55+
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
56+
}
5057
}
5158
}

0 commit comments

Comments
 (0)