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

Consuming compressed content throws exception

2012-04-25 Thread Michael.Fankanowsky
Hi all, when trying to consume deflate content coded responses I get java.util.zip.ZipException: invalid stored block lengths exception. server mock looks like: header is byte array Deflater def = new Deflater(Deflater.BEST_COMPRESSION); def.setInput(content); def.finish(); contentLength =

AW: How to test compressed response

2012-04-24 Thread Michael.Fankanowsky
My fault. After adding the necessary CRLF it works. String sHeader = HTTP/1.1 200 OK\r\n + Server: Apache\r\n + Content-Type: text/html\r\n + Content-Encoding: gzip\r\n; But when I receive the response I have only

AW: How to test compressed response

2012-04-24 Thread Michael.Fankanowsky
No - doesn't work (just forgot to mention it in my post). I did it after my last header field Content-Length:. Kind regards, Michael -Ursprüngliche Nachricht- Von: Sam Crawford [mailto:samcrawf...@gmail.com] Gesendet: Dienstag, 24. April 2012 11:20 An: HttpClient User Discussion

How to test compressed response

2012-04-23 Thread Michael.Fankanowsky
Hi all, I just want to test the handling of compressed responses. I have some java code which can do the compression of content and which listens to http get requests. But I actually have no idea how to send the response respectively which streams/writers to use and how to combine the message