Re: Some issues with simple rest application
Richard Zowalla <[email protected]> Tue, 02 Apr 2024 20:28:28 +0200
| Newsgroups | gmane.comp.java.openejb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I don't see an actual issue here. I have reproduced the example you
described in your mail here (declare a resource, add an application
servlet in web.xml):
https://github.com/rzo1/ml-jaxrs-repro
Running that on a TomEE 9.1.2 (Microprofile) deploys the resource as
expected:
02-Apr-2024 20:16:38.994 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints REST
Application: http://localhost:8282/myapp ->
org.apache.openejb.config.AnnotationDeployer$ProvidedJAXRSApplication@7a023e34
02-Apr-2024 20:16:38.996 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
Service URI: http://localhost:8282/myapp/health -> Pojo
org.apache.tomee.microprofile.health.MicroProfileHealthChecksEndpoint
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health -> Response
getChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health/live -> Response
getLiveChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health/ready -> Response
getReadyChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health/started -> Response
getStartedChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
Service URI: http://localhost:8282/myapp/myresource -> Pojo
com.github.rzo1.MyResource
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/myresource -> Response test()
Next, I went on and followed the instructions for the second example
(add a class extending Application, purge web.xml)
https://github.com/rzo1/ml-jaxrs-repro/tree/case-2
Also works as expected:
02-Apr-2024 20:16:38.994 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints REST
Application: http://localhost:8282/myapp ->
org.apache.openejb.config.AnnotationDeployer$ProvidedJAXRSApplication@7a023e34
02-Apr-2024 20:16:38.996 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
Service URI: http://localhost:8282/myapp/health -> Pojo
org.apache.tomee.microprofile.health.MicroProfileHealthChecksEndpoint
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health -> Response
getChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health/live -> Response
getLiveChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health/ready -> Response
getReadyChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/health/started -> Response
getStartedChecks()
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
Service URI: http://localhost:8282/myapp/myresource -> Pojo
com.github.rzo1.MyResource
02-Apr-2024 20:16:38.997 INFORMATION [main]
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
GET http://localhost:8282/myapp/myresource -> Response test()
Might have missed something from your explanation, though.
Gruß
Richard
Am Montag, dem 01.04.2024 um 20:15 +0000 schrieb COURTAULT Francois:
> THALES GROUP LIMITED DISTRIBUTION to email recipients
>
> Hello everyone,
>
> After having read the Jakarta Restful 3.0 specification.
> I want to check how it works.
>
> For that I have built a web application (war) without any Application
> subclass.
> According to the specification, I have to add a servlet with the name
> jakarta.ws.rs.core.Application in web.xml.
> In the war, I have:
>
> * a Root resource named MyResource
> @Path("myresource")
>
> public class MyResource {
>
> @GET
>
> public Response test () {
>
> return Response.ok().build();
>
> }
>
> }
>
> * web.xml with the following section
> <servlet>
>
> <servlet-name>jakarta.ws.rs.core.Application</servlet-name>
>
> </servlet>
>
> <servlet-mapping>
>
> <servlet-name>jakarta.ws.rs.core.Application</servlet-name>
>
> <url-pattern>/myapp/*</url-pattern>
>
> </servlet-mapping>
>
> Pb when I start up tomee-microprofile 9.1.2, I see:
> 01-Apr-2024 21:42:21.835 INFO [main]
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
> Service URI: http://localhost:8080/JAXRS/myapp/health -> Pojo
> org.apache.tomee.microprofile.health.MicroProfileHealthChecksEndpoint
> 01-Apr-2024 21:42:21.835 INFO [main]
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
> GET http://localhost:8080/JAXRS/myapp/health ->
> Response getChecks()
> 01-Apr-2024 21:42:21.835 INFO [main]
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
> GET http://localhost:8080/JAXRS/myapp/health/live ->
> Response getLiveChecks()
> 01-Apr-2024 21:42:21.835 INFO [main]
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
> GET http://localhost:8080/JAXRS/myapp/health/ready ->
> Response getReadyChecks()
> 01-Apr-2024 21:42:21.835 INFO [main]
> org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints
> GET http://localhost:8080/JAXRS/myapp/health/started ->
> Response getStartedChecks()
>
> No GET on a path with myresource ☹
> What’s wrong in my understanding of the spec (“REQUIRED …. and to
> automatically discover all root resource classes …”) ?
>
> Best Regards.
>
>
>