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)?
SCJP2, SCWCD 1.4, PMP, ITIL Foundation
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads