S
Scott Harper
I have a servlet that accepts POSTs from a J2ME client. I need the length of
the message body.
Ordinarily, I'd just read the Content-Length header (or call the
ServletRequest.getContentLength() method). Unfortunately, that header isn't
present. I'm pretty sure this is because there is a Transfer-Encoding header
present with a value of "chunked". Section 4.4 of the HTTP spec makes it
sound like the Transfer-Encoding and Content-Length headers don't always play
well together.
I'm not sure how the Transfer-Encoding header is getting added (I'm not
explicitly putting it there). I'm guessing that the MIDlet implementation is
putting it in there by default. At any rate, the size of data being passed is
certainly not large enough to warrant chunking.
Anyway, sections 3.6 and 3.6.1 of the HTTP spec seem to describe a way to get
the chunk size from the message body. But it sort of sounds like you need to
parse through the binary http packet to get at that data. There don't appear
to be any ServletRequest methods to get to it...
Does anyone have any pointers or examples on how to get this data?
thanks,
Scott
the message body.
Ordinarily, I'd just read the Content-Length header (or call the
ServletRequest.getContentLength() method). Unfortunately, that header isn't
present. I'm pretty sure this is because there is a Transfer-Encoding header
present with a value of "chunked". Section 4.4 of the HTTP spec makes it
sound like the Transfer-Encoding and Content-Length headers don't always play
well together.
I'm not sure how the Transfer-Encoding header is getting added (I'm not
explicitly putting it there). I'm guessing that the MIDlet implementation is
putting it in there by default. At any rate, the size of data being passed is
certainly not large enough to warrant chunking.
Anyway, sections 3.6 and 3.6.1 of the HTTP spec seem to describe a way to get
the chunk size from the message body. But it sort of sounds like you need to
parse through the binary http packet to get at that data. There don't appear
to be any ServletRequest methods to get to it...
Does anyone have any pointers or examples on how to get this data?
thanks,
Scott