vert-x3 / vertx-examples

Vert.x examples
Apache License 2.0
3.54k stars 2.09k forks source link

resteasy-vertx example exception #427

Open 1416360754 opened 3 years ago

1416360754 commented 3 years ago

Questions

in https://github.com/vert-x3/vertx-examples/tree/4.x/resteasy-examples/src/main/java/io/vertx/examples/resteasy/helloworld Serve.java ,After the start, visit http feedback: java.lang.NoSuchMethodError: io.vertx.core.http.HttpServerRequest.rawMethod()Ljava/lang/String; jdk1.8

`

  <groupId>io.vertx</groupId>
  <artifactId>vertx-core</artifactId>
  <version>4.1.0</version>
</dependency>

<dependency>
  <groupId>org.jboss.resteasy</groupId>
  <artifactId>resteasy-vertx</artifactId>
  <version>3.1.0.Final</version>
</dependency>

`

i find bug is resteasy-vertx used vertx3.x version. exception from org.jboss.resteasy.plugins.server.vertx.VertxRequestHandler. handle(HttpServerRequest request)

here method

`public void handle(HttpServerRequest request) { request.bodyHandler((buff) -> { Context ctx = this.vertx.getOrCreateContext(); ResteasyUriInfo uriInfo = VertxUtil.extractUriInfo(request, this.servletMappingPrefix); ResteasyHttpHeaders headers = VertxUtil.extractHttpHeaders(request); HttpServerResponse response = request.response(); VertxHttpResponse vertxResponse = new VertxHttpResponse(response, this.dispatcher.getProviderFactory()); VertxHttpRequest vertxRequest = new VertxHttpRequest(ctx, headers, uriInfo, request.rawMethod(), this.dispatcher.getDispatcher(), vertxResponse, false); if (buff.length() > 0) { ByteBufInputStream in = new ByteBufInputStream(buff.getByteBuf()); vertxRequest.setInputStream(in); } try { this.dispatcher.service(ctx, request, response, vertxRequest, vertxResponse, true); } catch (Failure var11) { vertxResponse.setStatus(var11.getErrorCode()); } catch (Exception var12) { vertxResponse.setStatus(500); LogMessages.LOGGER.error(Messages.MESSAGES.unexpected(), var12); }

        if (!vertxRequest.getAsyncContext().isSuspended()) {
            try {
                vertxResponse.finish();
            } catch (IOException var10) {
                var10.printStackTrace();
            }
        }

    });
}

`

tsegismont commented 3 years ago

I think we should remove this example from the 4.x branch. Users looking for an annotation-driven, reactive REST framework would better give a try to Quarkus.

Fine with you @vietj ?

1416360754 commented 3 years ago

Use annotation-driven is wonderful idea,it can let you just focus on the business,with future. - v -