Jersey Jackson and Spring Service

We are using Jersey, Jackson and Spring service (@service) annotation to expose some REST based Web-Services. Request and response data are exchanged in JSON Format.

Below is the Service Request Object content:

public class ServiceRequest{
   private RequestHeader requestHeader;
   private List<BaseEntity> requestData;

All specific entities will extend from BaseEntity class. For example :

public class User extends BaseEntity{
  private String userName;

For all service operation we accept only ServiceRequest Object by passing list of request data objects. Now when we try to call these operation from REST Client, these are failing with

 userName is not found as part of BaseEntity.

This is because while converting, Jersey/Jackson tries to autodetect the incoming field names with the specified object's property.

I want to know is there any way, I can handle this in an intelligent way. We do not have an option to change the signature of the Service. Really appreciate your help on this.


The below link has the answer for my question. Thank you for the support.

Polymorphism in jackson annotations: @JsonTypeInfo usage

Did you tried to use generics? You can declare concrete class type at Resource's to inform Jackson to map to specific type

Need Your Help

How to set swiper left and righ swipe limit?

android jquery slider swipe swiper

How can I make the left and right limit from swiper to be less??

Basics of manipulating variables in different classes

java class variables

I've done quite a bit of digging and can't seem to find the answer I'm looking for, I may be asking the question wrong because I'm pretty nooby.