Thanks again for your help.
{bundles: Array(11)}
- 0: {codePk: "DynamicBundle", label: "DynamicBundle", isActive: "1"}
- 1:{codePk: "TranscludeBundlesLoop", label: "Transclude bundles with a loop", isActive: "1"}
- 2:{codePk: "TranscludedBundleLoop1", label: "Transcluded bundle with a loop 1", isActive: "1"}
- 3:{codePk: "TranscludedBundleLoop2", label: "Transcluded bundle with a loop 2", isActive: "1"}
- 4:{codePk: "TranscludedBundleLoop1a", label: "Transcluded bundle with a loop 1a", isActive: "1"}
- 5:{codePk: "IsoLanguage", label: "Iso Languages", isActive: "1"}
- 6:{codePk: "Test_Bundle", label: "Test_Bundle", isActive: "1"}
- 7:{codePk: "TranscludeBundles", label: "Transclude bundles for tests", isActive: "1"}
- 8:{codePk: "TranscludedBundle1", label: "Transcluded bundle 1", isActive: "1"}
- 9:{codePk: "TranscludedBundle2", label: "Transcluded bundle 2", isActive: "1"}
- 10:{codePk: "TranscludedBundle1a", label: "Transcluded bundle 1a", isActive: "1"}
- length:11
- __proto__:Array(0)
- __proto__:Object
So, as a matter of fact, there is a "bundles" key having an array of 11 bundles as its value. Looking at the invoked service, I don't understand where this "bundles" value comes from. Here is the endpoint:
@GET
@Produces("application/json")
public I18nBundleList listAll(@QueryParam("start") Integer startPosition, @QueryParam("max") Integer maxResult)
{
List<I18nBundle> bundles = ejb.listAllBundles(startPosition, maxResult);
return new I18nBundleList(bundles);
}
It returns a list of I18nBundle objects. A Java client calls it like this:
I18nBundleList bundles = resource.queryParam("start", "0").queryParam("max", "1").type(MediaType.APPLICATION_JSON).get(I18nBundleList.class);
assertEquals(bundles.getBundles().size(), 1);
It might be that the Java to JSON marshalling process creates an element named "bundles" as the root of the JSON payload. But why "bundles" and where does it take it name ? And as you may see, in Java one is able to completely abstract the details of the marshalling/unmarshalling process, while using Angular HttpClient, one needs to know the name of the root element that has been generated, probably by the JAX-RS stack. It's quite disapointing in my opinion and it's a serious regression compared to JAX-RS.
Any comments ?
Kind regards,
Nicolas