Class LoggingBHttpClientConnection
- java.lang.Object
-
- org.apache.hc.core5.http.impl.io.BHttpConnectionBase
-
- org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
-
- org.apache.hc.core5.testing.classic.LoggingBHttpClientConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpConnection,BHttpConnection,HttpClientConnection,SocketModalCloseable,ModalCloseable,Identifiable
public class LoggingBHttpClientConnection extends DefaultBHttpClientConnection implements Identifiable
-
-
Constructor Summary
Constructors Constructor Description LoggingBHttpClientConnection(Http1Config http1Config)LoggingBHttpClientConnection(Http1Config http1Config, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory, HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(java.net.Socket socket)Binds this connection to the givenSocket.voidclose()Closes this connection gracefully.voidclose(CloseMode closeMode)Closes this process or endpoint and releases any system resources associated with it.java.lang.StringgetId()protected voidonRequestSubmitted(ClassicHttpRequest request)protected voidonResponseReceived(ClassicHttpResponse response)-
Methods inherited from class org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection
isConsistent, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader, terminateRequest
-
Methods inherited from class org.apache.hc.core5.http.impl.io.BHttpConnectionBase
awaitInput, bind, createContentInputStream, createContentOutputStream, ensureOpen, flush, getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, getSocketHolder, getSocketTimeout, getSSLSession, incrementRequestCount, incrementResponseCount, isDataAvailable, isOpen, isStale, setSocketTimeout, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.hc.core5.http.io.BHttpConnection
flush, isDataAvailable, isStale
-
Methods inherited from interface org.apache.hc.core5.http.HttpConnection
getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, getSSLSession, isOpen
-
Methods inherited from interface org.apache.hc.core5.http.SocketModalCloseable
getSocketTimeout, setSocketTimeout
-
-
-
-
Field Detail
-
COUNT
private static final java.util.concurrent.atomic.AtomicLong COUNT
-
id
private final java.lang.String id
-
log
private final org.slf4j.Logger log
-
headerLog
private final org.slf4j.Logger headerLog
-
wire
private final Wire wire
-
-
Constructor Detail
-
LoggingBHttpClientConnection
public LoggingBHttpClientConnection(Http1Config http1Config, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory, HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory)
-
LoggingBHttpClientConnection
public LoggingBHttpClientConnection(Http1Config http1Config)
-
-
Method Detail
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceIdentifiable
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:HttpConnectionCloses this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Useshutdowninstead.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceHttpConnection- Overrides:
closein classBHttpConnectionBase- Throws:
java.io.IOException
-
close
public void close(CloseMode closeMode)
Description copied from interface:ModalCloseableCloses this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.- Specified by:
closein interfaceModalCloseable- Overrides:
closein classBHttpConnectionBase- Parameters:
closeMode- How to close the receiver.
-
bind
public void bind(java.net.Socket socket) throws java.io.IOExceptionDescription copied from class:BHttpConnectionBaseBinds this connection to the givenSocket. This socket will be used by the connection to send and receive data.After this method's execution the connection status will be reported as open and the
BHttpConnectionBase.isOpen()will returntrue.- Overrides:
bindin classDefaultBHttpClientConnection- Parameters:
socket- the socket.- Throws:
java.io.IOException- in case of an I/O error.
-
onResponseReceived
protected void onResponseReceived(ClassicHttpResponse response)
- Overrides:
onResponseReceivedin classDefaultBHttpClientConnection
-
onRequestSubmitted
protected void onRequestSubmitted(ClassicHttpRequest request)
- Overrides:
onRequestSubmittedin classDefaultBHttpClientConnection
-
-