Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how many bytes can XMLHttpRequest.responseText hold?

 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to send a large chuck of data to a JSP file through XMLHttpRequest.responseText. But my data is truncated and I can only receive around 50k instead of 300k which is what I send. Is there a length limit for XMLHttpRequest? If so, is there any way to send a large chuck of data using XMLHttpRequest?

Any advice will be appreciated.

Thank you.

Caly
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this plain text/JSON. Are you setting this text in the body?

Eric
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's plain text.

I send a XMLHttpRequest to a Servlet in a JSP file. And in the Servlet I use ServletOutputStream to send the data back to the JSP.

I didn't set text/JSON in the header, though. Does it affect the length of the data that can be retrieved?
[ September 06, 2006: Message edited by: Caly LeeAnn ]
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I set the contentType to 'text/JSON' but it doesn't make a difference. I can still only receive around 50k data.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no standard mime type text/json. I also don't see what the content type would have to do with this issue.

Are you setting content-length?

If you hit resource directly with the browser, does the entire content body get loaded?
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I set the contentType to 'text/JSON' but it doesn't make a difference. I can still only receive around 50k data.
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

I didn't set the content length for the XMLHttpRequest. If I send a request through HttpRequest, I don't have this problem.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"text/JSON" isn't a valid mime type either, it should be "text/plain".

What happens if you set the content-length?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic