• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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)?
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic