Same evil happens when I try to send Multipart request:
        HttpClient client = new DefaultHttpClient();
        HttpPost post = new HttpPost(address);

        MultipartEntity entity = new MultipartEntity();
        entity.addPart("file", new FileBody(pack));
        post.setEntity(entity);

        HttpResponse response = client.execute(post);

        logObj.info(response.getStatusLine());
        if (response.getStatusLine().getStatusCode() !=
HttpURLConnection.HTTP_OK) {
            logObj.warn("file " + pack.getPath() + " was not transfered -
response code " +
                    response.getStatusLine().getStatusCode());
        }

I just can't understand why other POSTs work... Looks like something's wrong
with my servlet

2009/4/9 Andrey Razumovsky <razumovsky.and...@gmail.com>

> Hi friends,
>
> Problem still exists... Unforntunately I do not have a public URL. Could
> you share you HTTP POST request code.
> Lines with Content-Type, Content-Length etc are commented out because I
> tried them but they didn't help. Event if I set them, server receives GET
> with content-length=-1. Changing lines order and playing with header
> properties gave no result. And once again, my problem is NOT that Tomcat
> doesn't get POST body. It doesn't get POST at all!
> Will try multipart requests with HTTPClient, hope it'll help...
>
> Andrey
>
> 2009/4/8 André Warnier <a...@ice-sa.com>
>
> André Warnier wrote:
>> Trying to redeem myself to Andrey for hijacking his post..
>>
>> Andrey, in your (latest) client code you do not set either a
>> content-length, nor a "chunked" encoding headers.
>> Is it possible that Tomcat 6 just ignores your POST content in that case ?
>> In RFC2616, I find this in section 4.3 :
>>  The presence of a message-body in a request is signaled by the
>>   inclusion of a Content-Length or Transfer-Encoding header field in
>>   the request's message-headers. A message-body MUST NOT be included in
>>   a request if the specification of the request method (section 5.1.1)
>>   does not allow sending an entity-body in requests. A server SHOULD
>>   read and forward a message-body on any request; if the request method
>>   does not include defined semantics for an entity-body, then the
>>   message-body SHOULD be ignored when handling the request.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>

Reply via email to