aspose file tools*
The moose likes Web Services and the fly likes returning a generic list from REST Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "returning a generic list from REST " Watch "returning a generic list from REST " New topic
Author

returning a generic list from REST

Tim Sparg
Ranch Hand

Joined: Dec 29, 2006
Posts: 40
I'm trying to write some generic code that simplifies things for other developers in my company.

I'm currently getting stuck returning a list of generic items from a REST web service



the getList1(..) method functions perfectly, but the moment I take the concrete class references out and try and replace them with generics ( getList.(..) ) i get the following exception from my webservice:
com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type, interface java.util.List, and MIME media type, application/xml, was not found



am I declaring my generic code incorrectly?


There is no insanity so devastating in man's life as utter sanity
Tim Sparg
Ranch Hand

Joined: Dec 29, 2006
Posts: 40
Apparently the problem is around type erasures...

anyway the solution i found was to use an Array instead of a List

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: returning a generic list from REST