Server stub
@GET
@Path("/user/{id}")
@Produces(MediaType.APPLICATION_JSON)
public User getUser(@PathParam("id") String id){
User user = myService.getUserById(id);
if (user!= null){
return user;
}
return null;
}
============================== Client stub
User response = WinkRestClient.resource(path).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).get(User.class);
throw exception:
Exception in thread "main" java.lang.RuntimeException: A javax.ws.rs.ext.MessageBodyReader implementation was not found for class com.test.entity.User type and application/octet-stream media type. Verify that all entity providers are correctly registered. Add a custom javax.ws.rs.ext.MessageBodyReader provider to handle the type and media type if a JAX-RS entity provider does not currently exist.
at org.apache.wink.client.internal.handlers.ClientResponseImpl.readEntity(ClientResponseImpl.java:122)
at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:65)
at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:52)
at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:196)
at org.apache.wink.client.internal.ResourceImpl.get(ResourceImpl.java:303)
at com.wolianw.sale.bl.ClResourceTest.main(ClResourceTest.java:14)
when server stub return null ,the client throw this exception
what can I do,let the client don't throw exception,let response [User = null]