• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jersey Won't Use my ObjectMapper  RSS feed

Ron McLeod
Saloon Keeper
Posts: 1601
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use Jersey v2 with Jackson for a Java SE client application.

Following the instructions in the Jersey documentation, I created and registered a custom object mapper. I also registered JacksonFeature. As shown by the application output, my object mapper is being instanciated, but is never being used (no call to the getContext method). Also, my object mapper
has the SerializationFeature.INDENT_OUTPUT feature enabled, which I do not see in the request sent over the network. Further, the @JsonInclude(Include.NON_NULL) annotation is not being handled as I do see a null value being included in the request.

I'm sure there is something simple that I am missing, but I spent a good part of the weekend unsuccessfully trying to figure it out.

Can anyone suggest what I might be missing / doing wrong?

My custom object mapper:

My bean:

My test application:

Request sent:
PUT /hss HTTP/1.1
Accept: application/json
Content-Type: application/json
User-Agent: Jersey/2.8 (HttpUrlConnection 1.8.0_45)
Connection: keep-alive
Content-Length: 46

Command line output:
called MyObjectMapperProvider()

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!