• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ajax with Chunked Transfer-Encoding

 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a problem where JavaScript on the client side is making an asynchronous Ajax GET call to the server to receive some information in JSON format, and when the Ajax call completes, the JavaScript sees no content return, and does not display anything in the HTML table. If I type the same URL into the browsers URL box, I do see the raw JSON formatted content

I am pretty sure it has to do with the server side using chunked transfer (Transfer-Encoding: chunked rather than Content-Length: XXX), and that the Ajax implementation in jQuery not dealing with it properly. Has anyone else run into this and have a fix/work-around?


Server Side:
JBoss AS 7.1.3Final
JAX-RS using RESTEasy implementation
Web Server using Apache Tomcat implementation

Client Side:
Google Chrome VersiĆ³n 34.0.1847.131 m
jQuery 1.10.2


JAX-RS Application

JAX-RS Resource


HTML page


JavaScript with Ajax Call


Network Trace
GET /RegistrarUI/users/contacts HTTP/1.1
Host: 192.168.100.136:8080
Connection: keep-alive
Cache-Control: max-age=0
Accept: application/json, text/javascript, */*; q=0.01
X-User-Agent: javascript
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
Referer: http://192.168.100.136:8080/RegistrarUI/contacts.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,es;q=0.4,fr;q=0.2,ja;q=0.2


HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Wed, 07 May 2014 23:50:00 GMT

[{"username":"200","contactUri":"sip:200@192.168.100.143:58041","expiresSeconds":50},{"username":"110","contactUri":"sip:110@192.168.100.125:5090;rinstance=48786377cbc1fd43;transport=udp","expiresSeconds":25}]
 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arrrrrg - its always the simplest things that consume the most time.

I found my problem - in the HTML file. The id for the table is contacts, but I was trying to add rows to a table with an id of contacts-table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!