aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how many bytes can XMLHttpRequest.responseText hold? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how many bytes can XMLHttpRequest.responseText hold?" Watch "how many bytes can XMLHttpRequest.responseText hold?" New topic
Author

how many bytes can XMLHttpRequest.responseText hold?

Caly LeeAnn
Ranch Hand

Joined: Nov 22, 2005
Posts: 55
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
Is this plain text/JSON. Are you setting this text in the body?

Eric
Caly LeeAnn
Ranch Hand

Joined: Nov 22, 2005
Posts: 55
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

Joined: Nov 22, 2005
Posts: 55
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

Joined: Jan 10, 2002
Posts: 61662
    
  67

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Caly LeeAnn
Ranch Hand

Joined: Nov 22, 2005
Posts: 55
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

Joined: Nov 22, 2005
Posts: 55
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

Joined: Jan 10, 2002
Posts: 61662
    
  67

"text/JSON" isn't a valid mime type either, it should be "text/plain".

What happens if you set the content-length?
 
wood burning stoves
 
subject: how many bytes can XMLHttpRequest.responseText hold?