Hi Elias,

Thanks again for your help.

The console logs shows the following:

{bundles: Array(11)}

   1. 0: {codePk: "DynamicBundle", label: "DynamicBundle", isActive: "1"}
      2. 1:{codePk: "TranscludeBundlesLoop", label: "Transclude bundles 
      with a loop", isActive: "1"}
      3. 2:{codePk: "TranscludedBundleLoop1", label: "Transcluded bundle 
      with a loop 1", isActive: "1"}
      4. 3:{codePk: "TranscludedBundleLoop2", label: "Transcluded bundle 
      with a loop 2", isActive: "1"}
      5. 4:{codePk: "TranscludedBundleLoop1a", label: "Transcluded bundle 
      with a loop 1a", isActive: "1"}
      6. 5:{codePk: "IsoLanguage", label: "Iso Languages", isActive: "1"}
      7. 6:{codePk: "Test_Bundle", label: "Test_Bundle", isActive: "1"}
      8. 7:{codePk: "TranscludeBundles", label: "Transclude bundles for 
      tests", isActive: "1"}
      9. 8:{codePk: "TranscludedBundle1", label: "Transcluded bundle 1", 
      isActive: "1"}
      10. 9:{codePk: "TranscludedBundle2", label: "Transcluded bundle 2", 
      isActive: "1"}
      11. 10:{codePk: "TranscludedBundle1a", label: "Transcluded bundle 1a"
      , isActive: "1"}
      12. length:11
      13. __proto__:Array(0)
   1. __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

Le mercredi 23 août 2017 11:17:05 UTC+2, Sander Elias a écrit :
>
> Hi Nicolas.
>
> Inspect your network tab, and see what the server returns. I suspect it 
> returns something like this:
>
> "{"bundles":[{"codePk":"DynamicBundle","label":"DynamicBundle","isActive
> ":"1"},{"codePk":"IsoLanguage","label":"Iso Languages","isActive":"1"},{"
> codePk":"Test_Bundle","label":"Test_Bundle","isActive":"1"},{"codePk":"
> TranscludeBundles","label":"Transclude bundles for tests","isActive":"1
> "},{"codePk":"TranscludedBundle1","label":"Transcluded bundle 1","isActive
> ":"1"},{"codePk":"TranscludedBundle2","label":"Transcluded bundle 2","
> isActive":"1"},{"codePk":"TranscludedBundle1a","label":"Transcluded 
> bundle 1a","isActive":"1"}]}"
>
> what translates to:
> {
>     "bundles": [
>         {
>             "codePk": "DynamicBundle",
>             "label": "DynamicBundle",
>             "isActive": "1"
>         },
>         {
>             "codePk": "IsoLanguage",
>             "label": "Iso Languages",
>             "isActive": "1"
>         },
>         {
>             "codePk": "Test_Bundle",
>             "label": "Test_Bundle",
>             "isActive": "1"
>         },
>         {
>             "codePk": "TranscludeBundles",
>             "label": "Transclude bundles for tests",
>             "isActive": "1"
>         },
>         {
>             "codePk": "TranscludedBundle1",
>             "label": "Transcluded bundle 1",
>             "isActive": "1"
>         },
>         {
>             "codePk": "TranscludedBundle2",
>             "label": "Transcluded bundle 2",
>             "isActive": "1"
>         },
>         {
>             "codePk": "TranscludedBundle1a",
>             "label": "Transcluded bundle 1a",
>             "isActive": "1"
>         }
>     ]
> }
>
> when parsed. 
> The backend is giving you back something different as you are expecting.
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to