Hi Ortwin
On Fri 6. June 2008 14:11:47 Ortwin Glück wrote:
> DEBUG [main] org.apache.http.wire - >> "POST /post.html HTTP/1.1[EOL]"
> DEBUG [main] org.apache.http.wire - >> "Content-Length: 0[EOL]"
> DEBUG [main] org.apache.http.wire - >> "Host: www.zdila.sk[EOL]"
> DEBUG [main] org.apache.http.wire - >> "Connection: Keep-Alive[EOL]"
> DEBUG [main] org.apache.http.wire - >> "[EOL]"
>
> This first request is without entity body (0 length). Weird, but legal.
The first method should have been HttpGet, but it doesn't matter as even
HttPost with no entity is legal, as you mentioned. Fixing that and re-running
testcase doesn't solve the issue.
>
> DEBUG [main] org.apache.http.wire - >> "POST /post.html HTTP/1.1[EOL]"
> DEBUG [main] org.apache.http.wire - >> "Content-Length: 13[EOL]"
> DEBUG [main] org.apache.http.wire - >> "Host: www.zdila.sk[EOL]"
> DEBUG [main] org.apache.http.wire - >> "Connection: Keep-Alive[EOL]"
> DEBUG [main] org.apache.http.wire - >> "[EOL]"
>
>
> This POST request specifies 13 bytes content length but does not seem to
> send the entity body. Why, I don't now.
>
>
> Now the code that produces that is:
>
> postMethod.setEntity(new InputStreamEntity(new
> ByteArrayInputStream("submit=submit".getBytes()), 13));
>
> Why are you using an InputStreamEntity and not a StringEntity? This code is
> dependent on your default platform encoding, thus not portable. The size
> may not be correct. In any case the content type of the request will be
> wrong.
You are right this code is dependent on default charset platform. It wouldn't
work for UTF-16. I fixed that to:
postMethod.setEntity(new InputStreamEntity(new
ByteArrayInputStream("submit=submit".getBytes("US-ASCII")), 13));
Still no success. In any case this line is only for testcase purposes. In my
application I am actually doing:
postMethod.setEntity(new InputStreamEntity(request.getInputStream(),
request.getContentLength()));
where request is untouch HttpServletRequest. But it doesn't matter :-).
BTW if i replace both methods to HttpGet, I still get that I/O Error also with
retrying, but program doesn't get locked.
Thanks in advance
Best regards
--
Martin Zdila
CTO
M-Way Solutions Slovakia s.r.o.
Letna 27, 040 01 Kosice
Slovakia
tel:+421-908-363-848
mailto:[EMAIL PROTECTED]
http://www.mwaysolutions.com
xmpp:[EMAIL PROTECTED] (Jabber)
skype:m.zdila
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]