quarkus: RESTEasy Reactive does not expose correctly a Kogito-generated endpoint
Describe the bug
While addressing https://github.com/quarkusio/quarkus/issues/19868 I have created kiegroup/kogito-runtimes#1643 which makes our dependency on RestEasy less forceful. You have now to plug resteasy explicitly.
You can also use RestEasy reactive, and you may opt-out of automated rest generation.
However, when using resteasy reactive, although the endpoints show up in swagger they seem not to work.
Expected behavior
I should be able to send a request either via Swagger UI or cURL
Actual behavior
an error is returned instead
How to Reproduce?
get the PR
clone kiegroup/kogito-runtimes#1643
mvn install -Dquickly
get the examples; for convenience use this PR
cd kogito-examples/process-scripts-quarkus
change quarkus-resteasy and quarkus-resteasy-jackson to quarkus-resteasy-reactive and quarkus-resteasy-reactive-jackson
mvn quarkus:dev
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name" : "john"}' http://localhost:8080/scripts
<html><head><title>Error</title></head><body>HTTP method POST is not supported by this URL</body></html>%
or:
cd kogito-examples/rules-quarkus-helloworld
change quarkus-resteasy and quarkus-resteasy-jackson to quarkus-resteasy-reactive and quarkus-resteasy-reactive-jackson
mvn quarkus:dev
curl -H "Content-Type: application/json" -X POST -d '{"strings":["hello"]}' http://localhost:8080/hello
<html><head><title>Error</title></head><body>HTTP method POST is not supported by this URL</body></html>%
Output of uname -a or ver
No response
Output of java -version
openjdk version “11.0.11” 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.3
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 65 (56 by maintainers)
Commits related to this issue
- Ensure that Vertx Static resource handler can pick up generated resources This is needed to make Kogito work with RESTEasy Reactive (see https://github.com/quarkusio/quarkus/issues/20846#issuecomment... — committed to geoand/quarkus by geoand 3 years ago
- Ensure that Vertx Static resource handler can pick up generated resources This is needed to make Kogito work with RESTEasy Reactive (see https://github.com/quarkusio/quarkus/issues/20846#issuecomment... — committed to geoand/quarkus by geoand 3 years ago
- Ensure that Vertx Static resource handler can pick up generated resources This is needed to make Kogito work with RESTEasy Reactive (see https://github.com/quarkusio/quarkus/issues/20846#issuecomment... — committed to gsmet/quarkus by geoand 3 years ago
as soon as kiegroup/kogito-runtimes#1757 is merged most issues should be ruled out @vsevel
https://github.com/quarkusio/quarkus/pull/21190 should take care of the (first) issue
thanks for reporting, I don’t think the SVG addon was tested with resteasy /cc @cristianonicolai @nmirasch
@gsmet it’s been merged, so IIRC it’ll be even in Kogito 1.15 (i.e. Quarkus 2.6.2)
@evacchi is it on track for Quarkus 2.7? It would be very good to have it. Full platform release is planned for February 2nd (so the Platform PR must be merged at most on Feb 1st)
In case https://github.com/quarkusio/quarkus/pull/21190 is not clear, to make this work you need to include
quarkus-vertx-http-deployment-spi(it’s just a SPI module, so it does not bring any dependencies in other thanquarkus-core-deployment) and then generateAdditionalStaticResourceBuildItemin yourpublic class KogitoQuarkusResourceUtils#registerResourcesfor resources that are supposed to be accessible from the web application.AdditionalStaticResourceBuildItemwill likely end up being backported to2.4.2.Finalso you won’t have to wait for2.5.0.CR1.ok it was originally, I guess I’ll have to put it back 😅 I must have misunderstood the difference
Yes, using
javax.ws.rs.core.Responseis the JAX-RS standard way to go here.enrich response headers https://github.com/kiegroup/kogito-runtimes/blob/fff3b78374da815bbda61e4e7a4fd73592a3a075/kogito-codegen-modules/kogito-codegen-decisions/src/main/resources/class-templates/DecisionRestResourceQuarkusTemplate.java#L36-L35
WIP ironing out that kink https://github.com/kiegroup/kogito-runtimes/pull/1669 in the meantime, excluding the undertow from kogito dependencies should work
trying…