LoggingManagedHttpClientConnection.java (httpcomponents-client-4.5.6-src) | : | LoggingManagedHttpClientConnection.java (httpcomponents-client-4.5.7-src) | ||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
import org.apache.http.HttpRequest; | import org.apache.http.HttpRequest; | |||
import org.apache.http.HttpResponse; | import org.apache.http.HttpResponse; | |||
import org.apache.http.config.MessageConstraints; | import org.apache.http.config.MessageConstraints; | |||
import org.apache.http.entity.ContentLengthStrategy; | import org.apache.http.entity.ContentLengthStrategy; | |||
import org.apache.http.io.HttpMessageParserFactory; | import org.apache.http.io.HttpMessageParserFactory; | |||
import org.apache.http.io.HttpMessageWriterFactory; | import org.apache.http.io.HttpMessageWriterFactory; | |||
class LoggingManagedHttpClientConnection extends DefaultManagedHttpClientConnect ion { | class LoggingManagedHttpClientConnection extends DefaultManagedHttpClientConnect ion { | |||
private final Log log; | private final Log log; | |||
private final Log headerlog; | private final Log headerLog; | |||
private final Wire wire; | private final Wire wire; | |||
public LoggingManagedHttpClientConnection( | public LoggingManagedHttpClientConnection( | |||
final String id, | final String id, | |||
final Log log, | final Log log, | |||
final Log headerlog, | final Log headerLog, | |||
final Log wirelog, | final Log wireLog, | |||
final int buffersize, | final int bufferSize, | |||
final int fragmentSizeHint, | final int fragmentSizeHint, | |||
final CharsetDecoder chardecoder, | final CharsetDecoder charDecoder, | |||
final CharsetEncoder charencoder, | final CharsetEncoder charEncoder, | |||
final MessageConstraints constraints, | final MessageConstraints constraints, | |||
final ContentLengthStrategy incomingContentStrategy, | final ContentLengthStrategy incomingContentStrategy, | |||
final ContentLengthStrategy outgoingContentStrategy, | final ContentLengthStrategy outgoingContentStrategy, | |||
final HttpMessageWriterFactory<HttpRequest> requestWriterFactory, | final HttpMessageWriterFactory<HttpRequest> requestWriterFactory, | |||
final HttpMessageParserFactory<HttpResponse> responseParserFactory) { | final HttpMessageParserFactory<HttpResponse> responseParserFactory) { | |||
super(id, buffersize, fragmentSizeHint, chardecoder, charencoder, | super(id, bufferSize, fragmentSizeHint, charDecoder, charEncoder, | |||
constraints, incomingContentStrategy, outgoingContentStrategy, | constraints, incomingContentStrategy, outgoingContentStrategy, | |||
requestWriterFactory, responseParserFactory); | requestWriterFactory, responseParserFactory); | |||
this.log = log; | this.log = log; | |||
this.headerlog = headerlog; | this.headerLog = headerLog; | |||
this.wire = new Wire(wirelog, id); | this.wire = new Wire(wireLog, id); | |||
} | } | |||
@Override | @Override | |||
public void close() throws IOException { | public void close() throws IOException { | |||
if (super.isOpen()) { | if (super.isOpen()) { | |||
if (this.log.isDebugEnabled()) { | if (this.log.isDebugEnabled()) { | |||
this.log.debug(getId() + ": Close connection"); | this.log.debug(getId() + ": Close connection"); | |||
} | } | |||
super.close(); | super.close(); | |||
skipping to change at line 121 | skipping to change at line 121 | |||
protected OutputStream getSocketOutputStream(final Socket socket) throws IOE xception { | protected OutputStream getSocketOutputStream(final Socket socket) throws IOE xception { | |||
OutputStream out = super.getSocketOutputStream(socket); | OutputStream out = super.getSocketOutputStream(socket); | |||
if (this.wire.enabled()) { | if (this.wire.enabled()) { | |||
out = new LoggingOutputStream(out, this.wire); | out = new LoggingOutputStream(out, this.wire); | |||
} | } | |||
return out; | return out; | |||
} | } | |||
@Override | @Override | |||
protected void onResponseReceived(final HttpResponse response) { | protected void onResponseReceived(final HttpResponse response) { | |||
if (response != null && this.headerlog.isDebugEnabled()) { | if (response != null && this.headerLog.isDebugEnabled()) { | |||
this.headerlog.debug(getId() + " << " + response.getStatusLine().toS | this.headerLog.debug(getId() + " << " + response.getStatusLine().toS | |||
tring()); | tring()); | |||
final Header[] headers = response.getAllHeaders(); | final Header[] headers = response.getAllHeaders(); | |||
for (final Header header : headers) { | for (final Header header : headers) { | |||
this.headerlog.debug(getId() + " << " + header.toString()); | this.headerLog.debug(getId() + " << " + header.toString()); | |||
} | } | |||
} | } | |||
} | } | |||
@Override | @Override | |||
protected void onRequestSubmitted(final HttpRequest request) { | protected void onRequestSubmitted(final HttpRequest request) { | |||
if (request != null && this.headerlog.isDebugEnabled()) { | if (request != null && this.headerLog.isDebugEnabled()) { | |||
this.headerlog.debug(getId() + " >> " + request.getRequestLine().toS | this.headerLog.debug(getId() + " >> " + request.getRequestLine().toS | |||
tring()); | tring()); | |||
final Header[] headers = request.getAllHeaders(); | final Header[] headers = request.getAllHeaders(); | |||
for (final Header header : headers) { | for (final Header header : headers) { | |||
this.headerlog.debug(getId() + " >> " + header.toString()); | this.headerLog.debug(getId() + " >> " + header.toString()); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 9 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added |