hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Galambos ...@hq.egothor.org>
Subject Migration 4.0 -> 4.2
Date Sat, 21 Jul 2012 19:54:06 GMT
Hello,

I have just decided to migrate my project from API 4.0 to 4.2. There is
a lot of new stuff, so I am not sure what's the best way to
(re)implement the following logic. Can you enlighten me, please? Thank you!

Short story: I need to
a) assign some initial values for HTTP requests,
b) process the HTTP responses with respective callbacks, and
c) cancel a request when it produces a long response data stream.

Current (4.0 API) implementation: The application uses
NHttpClientHandler as a wrapper for NHttpRequestExecutionHandler. This
execution handler (exec-handler) assigns some starting values, e.g.
user-agent and target-host, according to an attachment object in
initalizeContext(). The handler also constructs a special entity (see
responseEntity method) that throws an exception when the data stream is
too long. The exception is caught and handled in an event listener (see
EventListener interface) registered in the client-handler (see
setEventListener). Finally, the body of the response is processed (see
exec-handler's handleResponse method) by a callback stored in the
context object.

LG

BTW: Obviously, I can share the source code.


---------------------------------------------------------------------
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