hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florent Georges <li...@fgeorges.org>
Subject EntityTemplate.setChunked() ignored?
Date Mon, 23 Feb 2009 15:59:07 GMT

  Hi,

  I have the following piece of code, where I create a POST
request, based on the class StringProducer, a simple
implementation of ContentProducer that output a string (see
below):

    // the request entity
    ContentProducer prod = new StringProducer(content);
    EntityTemplate entity = new EntityTemplate(prod);
    entity.setChunked(false);

    // the POST method, with the above entity
    HttpPost post = new HttpPost(uri);
    post.setEntity(entity);
    client.execute(post);

  StringProducer is simply:

    private static class StringProducer
            implements ContentProducer
    {
        public StringProducer(String content) {
            myContent = content;
        }
        @Override
        public void writeTo(OutputStream out) throws IOException {
            out.write(myContent.getBytes());
        }
        private String myContent;
    }

  Note the following statement above:

    entity.setChunked(false);

  But in the logs, I get the following:

    [DEBUG] wire - >> "POST ***** HTTP/1.1[EOL]"
    [DEBUG] wire - >> "Transfer-Encoding: chunked[EOL]"
    [DEBUG] wire - >> ...

  Is that normal?

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/























      

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message