2 Replies Latest reply on Jan 11, 2018 2:52 AM by gmgallo

    Content-length not returned with wf10 and resteasy

    gmgallo

      Hi guys

       

      I'm developing a simple web page that makes an ajax request to the server that retrieves a base64 file and returns to the client. In this page i want to monitor the operation trough a progress bar, so I added this code in my .js:

      $.ajax({
           method: 'GET',
      url: '../iwnloadsservice/'+$(this).attr('id'),
      datatype: 'json',
      progress: function(e) {
      if(e.lengthComputable) {
      }
      }
      });
      

      I immediately noticed that e.lengthComputable is always false and I spent 3 hours on google to understand why. Then I tried with soapUI and I noticed that wildfly (or rest easy) is not returning the content-length. This is the response:

      HTTP/1.1 200 OK
      Connection: keep-alive
      X-Powered-By: Undertow/1
      Server: WildFly/9
      Transfer-Encoding: chunked
      Content-Type: application/json
      Date: Wed, 10 Jan 2018 14:20:31 GMT
      
      
      {"result":1, "file": "base64String"}
      

       

      I'm becoming crazy because I can't understand why the server is not returning the length of the response. Any idea?

       

      Thanks in advance