Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 34
Registered: ‎07-05-2011
My Device: Various
My Carrier: Generic

Reading chunked server response (Transfer-Encoding=chunked)

SO, in desperation I flee to the forums...



Server (Jersey+Jackson+Glassfish) is producing JSON with Transfer-Encoding set to to "chunked". This is well, and makes sense. If checked in browser, all is well.


HOWEVER, if I try to read from a InputStream (obtained via HttpConnection) when chunked transfer encoding is in effect, I can get maxium 4040 bytes, after which the input stream returns -1 (i.e. end of stream), and that is that.


So if my response entity happened to be larger than 4040 bytes, I'm screwed.

This is happening in the simulator btw, over "fake" wifi connection.

I have not yet had the guts (and opportunity to test on physical device).


I did find this link:



It does not seem entirely applicable, since I'm not trying to fetch a large, known entity, instead we are streaming dynamic content.


Currently we are implementing work-a-rounds to try and keep responses below the 4040 byte mark (compression, db query limits etc).


ANYBODY got any ideas?