There is a mismatch between the amout of data that you are declaring you are going to send, and the amount of data that you are actually sending - Jetty issues a warning.
It looks like you are setting contentLength to 17 and then sending 19 bytes - hence the warning.
If you set contentLength to the correct value (19), the warning goes away.
What is the problem ?
Do you have to set the contentLength ?
Do you think that Jetty is miscalculating the amount of content that you are actually sending ?
OK - now I've looked at the code snippet !
I suspect that you are probably need to account for a newline and maybe a terminator of some kind at the end of your message - I'll check with the powers-that-be.
Or just don't bother setting the content length at all!
Jetty will handle that for you if your client in HTTP/1.1
you only really need to set your own content length if you have lots of http/1.0 clients.
Thank's for the reply. Actually those code above is J2ME code (MIDlet). I'm trying to make a POST Connection with servlet that in turns will make connection to session bean. Have anybody find out about this??Help!
By the way the reason why I have to add 2 because when I'm sending a message with a length of 17 it will complain : 10:55:35,526 WARN [jbossweb] WARNING: Invalid length: Content-Length=17 written
=19 for http://localhost:8080/
so that's why I decided to add 2 and it will stop complaining. Anybody?? help..:)
did you read my answer ?
You are probably adding one byte because you are using printLN which will append a newline.
The other byte is probably a terminator.
As Greg says, there is probably no need for you to explicitly set the ContentLength anyway.
Thank's for replying.. I change the println to print and it fix the problem. Thank you guys , you're awesome...:)