I am having alot of trouble getting dispatch 0.9.4 to read a chunked encoded as it comes in. The problem is that it seems to always wait for the complete message, getting a 200 OK, before it allows me to start reading the inputstream. For example in apache.commons i just did this
post = new PostMethod("http://www.myrestcall.com/callme")
inStream = post.getResponseBodyAsStream();
client.executeMethod(post);
var c = 0;
while ({c = inStream.read(); c != -1}) {
print(c.asInstanceOf[Char])
}
Using apache http the above will start reading each character from the body as it comes in.
I am trying to do this same thing with dispatch.. here is what I have.
val subReply = Http(url("http://myrestcall") > as.Response(_.getResponseBodyAsStream()))
var read = 0;
for (c <- subReply) {
while({read = c.read; read != -1}){
print(c.asInstanceOf[Char])
}
}
How can i start reading the input stream right away, and not have to wait for the entire connection to close and be finished?