I have to implement basic CRUD operations on a serious number of Entities. The to-be-executed code is identical for all classes, except that different DAO implementating classes are involved. So I decided to go for reflection, so instead of:

/@Path(...)
@Produces(...)
implements UserService
UserServiceImpl
{
   @GET
   public void list() {... same code over and over again... }

   @POST
   public void add(User user) {... //same code over and over again... //}
}
/

I have


/@Path(...)
@Produces(...)
UserServiceImpl extends AbstractServiceImpl<User>
implements UserService
{
}


abstract AbstractServiceImpl<T>
{
   @GET
   public void list() {... reflection ...}

   @POST
   public void add(User user) {...// reflection ...//}
}
/

This works fine for REST-GET but not for REST-POST, there I get a "No message body reader found for request class : Object, ContentType : text/xml". This most definitely has to do with the resolving of the @POST, because if I add the code below the the UserServiceImpl, then it all works ok.

/    @POST public void add(User user) { super.add(user); }

/Any suggestions on why?

Tom

Reply via email to