0

I have restful service with resource which consumes json, but when i send test request i got empty values in my model object. Here is service:

@Path("bot")
public class BotResource {

    private final Logger log = LogManager.getLogger(BotResource.class);

    @POST
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public Response update(Json update){
        log.info("test");
        return Response
                .ok()
                .build();
    }
}

Here is model object

import com.fasterxml.jackson.annotation.JsonProperty;
public class Json {
    @JsonProperty("update_id")
    private String Id;

    public Json() {
    }

    public String getId() {
        return Id;
    }

    public void setId(String Id) {
        this.Id = Id;
    }

}

so when i send post request with body {"update_id": 37197384} i have null attribute Id. Glassfish 5 causes no errors about this.

  • seems like @JsonProperty is ignored...Or how to turn on logging about this moment to see whats the problem. – kostya2394 Nov 07 '19 at 12:20
  • I think you need to enable Jackson as JSON provider. See here https://stackoverflow.com/questions/49793289/how-to-use-jackson-2-in-payara-5 – Christoph John Nov 07 '19 at 12:40

0 Answers0