Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-26126

[GSS](8.0.z) Record is not serialized to JSON

XMLWordPrintable

    • False
    • None
    • False
    • Known Issue

      I have following JAX-RS resource (see attached file):

      
      @Path("test")
      @ApplicationPath("rest")
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      public class DemoApplication extends Application {
      
          public record Data(String data) {}
      
          @GET
          @Path("short-record-response")
          public Response shortRecordR() {
              return Response.ok().entity(new Data("ok")).build();
          }
      
          @GET
          @Path("short-record")
          public Data shortRecord() {
              return new Data("ok");
          }
      }
      

      I get a correct response with 8.0.0.Beta:

      $ curl -X GET -H 'Accept: */*' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-record' 
      HTTP/1.1 200 OK
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 13
      Date: Fri, 24 Nov 2023 15:13:56 GMT
      
      {"data":"ok"}
      
      $ curl -X GET -H 'Accept: */*' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-record-response' 
      HTTP/1.1 200 OK
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 13
      Date: Fri, 24 Nov 2023 15:14:28 GMT
      
      {"data":"ok"}
      

      However, serialization fails on 8.0.0.GA.CR2 and CR1:

      $ curl -X GET -H 'Accept: */*' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-record-response' 
      HTTP/1.1 200 OK
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 2
      Date: Fri, 24 Nov 2023 15:17:58 GMT
      
      {}
      
      $ curl -X GET -H 'Accept: */*' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-record' 
      HTTP/1.1 200 OK
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 2
      Date: Fri, 24 Nov 2023 15:18:03 GMT
      
      {}
      

      If I define simple container class for a string (with getter and setter) - see the attachment, it gets serialized correctly.

              dkreling Daniel Kreling
              istraka@redhat.com Ivan Straka
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: