java.lang.NullPointerException at org.apache.http.entity.StringEntity.init(StringEntity.java:70

2012-05-25 Thread Michael.Fankanowsky
Hi all,

I receive a NullPointerException when I'm doing this:

HttpPost method = new HttpPost(someUri);
ContentType ct = ContentType.create(text/xml);
StringEntity entity = new StringEntity(someString, ct);
method.setEntity(entity);

The javadoc says that parameter charset is optional for ContentType but it 
seems not for StringEntity.
I have the requirement to send a http post with content-type: text/xml in the 
http header but without a charset. Do I create the HttpPost in a wrong manner 
or does the requirement make no sense or is it a bug?

Kind regards,

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



Re: POST Request How to enable Chunk Size

2012-05-25 Thread Oleg Kalnichevski
On Thu, 2012-05-24 at 15:13 -0700, anr wrote:
 
 DEBUG org.apache.http.wire -  800[\r][\n]
  org.apache.http.wire -  800[\r][\n]
 
 CoreConnectionPNames.SOCKET_BUFFER_SIZE
 CoreConnectionPNames.MIN_CHUNK_LIMIT
 
 How to change the transfer encoding chunk size when request is posted. I
 want to set different chunk sizes when we post a request.
 
 Thanks

Per default HttpClient use 2048 byte cache for chunk coded output. So,
the chunks should be about 2048 bytes, unless one explicitly uses #flush
method to flush out smaller chunks.

There is currently no (easy) way of overriding the default size of the
chunk cache without creating a custom entity serializer and custom HTTP
connection class.

Oleg


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