Jersey 1.6 can produce:
@Path(\"/stock\")
public class StockResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public List get()
my solution for methods that use AsyncResponse
@GET
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void list(@Suspended
final AsyncResponse asyncResponse) {
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
executorService.submit(() -> {
List res = super.listProducts();
Product[] arr = res.toArray(new Product[res.size()]);
asyncResponse.resume(arr);
});
}