On Tue, 2009-03-03 at 12:53 +0530, Asankha C. Perera wrote: > Hi All > > I wanted to write an echo service, and found that I cannot copy the > entity from the request as the response.. Also see : > http://hc.apache.org/httpcomponents-client/httpclient/xref-test/org/apache/http/localserver/EchoHandler.html#95 > > For small requests copying it into a byte array would work, but I am > suspecting there is another way? > > thanks > asankha >
Hi Asankha The problem is that lots of HTTP agents out there (including HttpClient 3.x and HttpClient 4.0) can only handle request / response content streams sequentially. That is, they can start reading response content only after the request content has been fully written out. You can try passing the input stream of the incoming request entity to the outgoing response entity to avoid buffering the entire message content in memory, but I suspect this will not work with many HTTP agents out there, especially for larger content entities. Oleg > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org > For additional commands, e-mail: dev-h...@hc.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org