• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chunked transfer-encoding problem

 
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My J2ME application was recently tested and came out with a big problem on boundary conditions testing. When the client was sending less than 2048 bytes to the server it was able to handle it right. The content-length header is being set in the client and was available at the server. The client uses javax.microedition.io.HttpConnection class to make HTTP connection to server. Here is the code snippet:


When the client data exceeds 2048 bytes I noticed from the Network Monitor tool of Wireless Toolkit that the "content-length" header was missing and another header "transfer-encoding" with value as "chunked" was being inserted. I Googled and found some discussions over this here, here and here. But none of the solutions discussed tell me how to dela with the problem on server side.

Note that when the server is sending data in chunks my J2ME client is able to handle it but not vice-versa. Infact Network Monitor tells me that as soon as data becomes even 2049 bytes the headers are sent correctly (again with no content-length and with chunked transfer-encoding) however the body is just empty. Since the body is empty my Servlet is unable to procure any request parameter and the request bombs.

Now on to the questions:
1. Why is the request body being sent as empty when data exceeds 2048 bytes? How do I make sure the data is sent in body properly?
2. Does my server need to be written differently to handle chunked request data (rather than doing request.getParameter() to read request attributes)?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic