After some experimentation, here is what I have found out. Perhaps others may find it useful.
If you define array, list, or collection as the return value, it does not work:
@GET
@Produces("application/json")
public String[] getIt() { // THIS DOES NOT WORK
...
}
However, if you wrap your collection in another class, it works:
@XmlRootElement
public class MyItem {
public String[] items;
}
@GET
@Produces("application/json")
public MyItem getIt() { // THIS WORKS
...
}
This seems to be a limitation in Jersey's implementation. A similar web service under Windows (WCF) does not have an issue returning String[] from a web service method.
Regards,
Peter