hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walco van Loon <wwwa...@gmail.com>
Subject Preferred approach for wire level request "tracing" in HttpClient 4.2/4.3
Date Mon, 06 May 2013 20:39:52 GMT

I'm currently in the process of upgrading HttpClient from 4.1 to 4.2, (but
also looking at the changes in 4.3-beta1) and meeting some challenges on
the way.

One of them is the replacement of deprecated API, most notably

Previously we created a subclass of ThreadSafeClientConnManager to
implement wire level HTTP request/response pair tracing for debugging
purposes. To achieve this we implemented a subclass of
DefaultClientConnection that writes all HTTP requests and associated
responses to disk, by using a specific
org.apache.http.io.Session(Input|Output)Buffer implementation, analogous to
org.apache.http.impl.conn.LoggingSession(Input|Output)Buffer. We used the
DefaultClientConnectionOperator hook to expose our implementation of
DefaultClientConnection to ThreadSafeClientConnManager.

The drawback of our current approach is that we used a rather ugly way
(using reflection) to close the forked input and output streams in an
override of ThreadSafeClientConnManager.releaseConnection() because
DefaultClientConnection instances are wrapped in a ManagedClientConnection
instance and the managed DefaultClientConnection was not directly
accessible. Due to API changes, this hack is no longer possible in 4.2.

What would be the preferred approach to implement this functionality in


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message