[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-15 Thread nicolas duminil
Not stringifying it, like this: myReader.readAsText(new Blob([this.importContext], { type: "application/json" })); gives: myReader.result "[object Object]" Le vendredi 15 septembre 2017 15:50:51 UTC+2, Sander Elias a écrit : > > Hmm, the myReader.result is already a string, so stringifying it d

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-15 Thread nicolas duminil
Hi Sander, Have tried with Firefox and it displays the same: myReader.result "{\"multiple\":false,\"createUpdate\":null,\"createMissingBundles\":false,\"createMissingMessages\":false}" Could you please develop on "as you are stringify's the bare string" ? I don't know what a polyfill for formD

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-15 Thread nicolas duminil
Hi Sander, Yes, it helps a lot, thanks. I inserted this code: var myReader = new FileReader(); myReader.onload = function (event) { console.log("myReader.result",JSON.stringify(myReader.result)); }; myReader.readAsText(new Blob([JSON.stringify(this.importContext)], { type: "application/json"

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-15 Thread nicolas duminil
Hi Sander, Thanks again for all this trouble. I made this modification so I replaced event.formData.append("import-context", new Blob([JSON.stringify(this.importContext)], { type: "application/json"})); by event.formData.append("import-context", new Blob([JSON.stringify(this.importContext)],

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-15 Thread nicolas duminil
Sorry, the stringified value is: {"multiple":false,"createUpdate":null,"createMissingBundles":false,"createMissingMessages":false} Le vendredi 15 septembre 2017 11:21:15 UTC+2, nicolas duminil a écrit : > > Hi Sander, > > Yes, this is the

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-15 Thread nicolas duminil
Hi Sander, Yes, this is the ouput value: ImportInputContext {multiple: false, createUpdate: NaN, createMissingBundles: false, createMissingMessages: false} Do you see anything wrong here ? Many thanks in advance for your help. Nicolas Le vendredi 15 septembre 2017 03:14:48 UTC+2, Sander Elia

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-14 Thread nicolas duminil
Hi Sander, Thanks for your reply. Looking at this link, I don't see any relation with the issue I posted. Could you please explain ? Many thanks in advance, Nicolas Le lundi 11 septembre 2017 17:02:28 UTC+2, Sander Elias a écrit : > > Hi Nicolas, > > I think your answer is here: > https://sta

[AngularJS] Re: Angular 4 - multipart support in HttpClient

2017-09-11 Thread nicolas duminil
Does anyone fell concerned please ? Le mercredi 6 septembre 2017 17:40:50 UTC+2, nicolas duminil a écrit : > > Hello, > > From an Angular component, I need to call a JAX-RS service having this > signature: > > @POST > > @Path("/import") > &

[AngularJS] How to download an Excel file with Angular 4 and HttpClient ?

2017-09-11 Thread nicolas duminil
Hello, I need to call a JAX-RS service which returns an excel file and i need to download locally this file. I have googled to see how to do it in Angular and found lots of samples for Angular 2 which don't work in Angular 4 and HttpClient. For example I found this: public downloadFile2(bundl

[AngularJS] Angular 4 - multipart support in HttpClient

2017-09-06 Thread nicolas duminil
Hello, >From an Angular component, I need to call a JAX-RS service having this signature: @POST @Path("/import") @Produces(MediaType.*APPLICATION_JSON*) @Consumes(MediaType.*MULTIPART_FORM_DATA*) *public* Response uploadExcelFile(FormDataMultiPart form) *throws* Exception I need

Re: [AngularJS] Angular 4.3.4 - HTTP 415 Usupported Media Type on POST

2017-08-25 Thread nicolas duminil
looks like you're > sending JSON but leaving the default content type of "text/plain" which > your server does not appear to support. > > On Fri, Aug 25, 2017, 08:31 nicolas duminil < > nicolas...@simplex-software.fr > wrote: > >> Greetings, >

[AngularJS] Angular 4.3.4 - HTTP 415 Usupported Media Type on POST

2017-08-25 Thread nicolas duminil
Greetings, I have a JAX-RS resource which signature is as follows: @POST @Path("myPath") @Produces({MediaType.APPLICATION_OCTET_STREAM}) @Consumes(MediaType.APPLICATION_JSON) public Response myResource(MyObject) throws Exception { ... } where MyObject is defined as: @XmlRootElement pu

[AngularJS] Re: Trying to iterate through an Array

2017-08-24 Thread nicolas duminil
Hi Sander, Yes, you were right, I found the problem. Basically, the back-end returns an object of class BundleList which contains a List named bundles. Hence the Java to JSON serializing process creates a ket/value pair having the name "bundles" with the value a List. This explains the behavio

[AngularJS] Re: Trying to iterate through an Array

2017-08-23 Thread nicolas duminil
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:{code

[AngularJS] Re: Trying to iterate through an Array

2017-08-23 Thread nicolas duminil
Hi Sander, There is something very misterious here and I'll try to explain: I have the following service: @Injectable() export class BundleService { private url = environment.bundleServiceCallUrl; constructor(private http: HttpClient) { } public getBundles(): Observable> { const params = new Ht

[AngularJS] Re: Trying to iterate through an Array

2017-08-22 Thread nicolas duminil
Hi Sander, Yes, you're right, this is what I got. However, here is my code: this.bundleService.getBundles().subscribe((bundlesArray: Array) => { console.log("*** Got bundles:", bundlesArray); console.log("*** Types:", typeof bundlesArray, Array.isArray(bundlesArray)); for (let bundle of bundlesAr

[AngularJS] Trying to iterate through an Array

2017-08-21 Thread nicolas duminil
Hello, I'm trying to iterate through an Array, as follows: myArray = new Array(); ... console.log(myArray); console.log("*** myArray.length", myArray.length); for (let m of myArray) { console.log(m); } Running this code, correctly displays the content of myArray array, there are 7 MyStuff ele

[AngularJS] Am I the only one thinking that a project having 20 thousands files is unusable ?

2017-08-09 Thread nicolas duminil
Greetings, I recently tried to start and Angular tutirial and, after having ran the famous command: ng --ng4 angular-hello-world I found myself with a new project having 23 118 files ! What's the point of such a project ? Who could reasonably use something like that ? I'm doing Java and Java

[AngularJS] Am I the only one to think that projects with 20 thousands files are simply unusable ?

2017-08-09 Thread nicolas duminil
Greetings, I recently tried to start and Angular tutirial and, after having ran the famous command: ng --ng4 angular-hello-world I found myself with a new project having 23 118 files ! What's the point of such a project ? Who could reasonably use something like that ? I'm doing Java and Java