I recently switched to jersey 2 ,.
I went through the documentation/web and got to know how to convert response class to custom class using .readEntity(ClassName.class);
But I am stuck at using CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
naming strategy.
The current conversion fails as the response fields are with "_" and my POJO has Snake case .
Any help will be appreciated.
In jersey1 , I have been doing this :
MyResponse myResponse = client
.resource(url)
.type(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.post(RequestClass.class, request);
the same I am not able to achieve post jersey 2 : It gives compile time error when I as in above code :
I also tried :
MyResponse myResponse = client
.target(getUrl())
.request()
.post(Entity.entity(request, MediaType.APPLICATION_JSON))
.readEntity(MyResponse.class);
but it's not creating myResponse
object , cause the response I get has Snake_case response but my POJO has camel case fields.