Class LoggingBHttpServerConnection
- java.lang.Object
-
- org.apache.hc.core5.http.impl.io.BHttpConnectionBase
-
- org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection
-
- org.apache.hc.core5.testing.classic.LoggingBHttpServerConnection
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,HttpConnection
,BHttpConnection
,HttpServerConnection
,SocketModalCloseable
,ModalCloseable
,Identifiable
public class LoggingBHttpServerConnection extends DefaultBHttpServerConnection implements Identifiable
-
-
Constructor Summary
Constructors Constructor Description LoggingBHttpServerConnection(java.lang.String scheme, Http1Config http1Config)
LoggingBHttpServerConnection(java.lang.String scheme, Http1Config http1Config, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory, HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(java.net.Socket socket)
Binds this connection to the givenSocket
.void
close()
Closes this connection gracefully.void
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated with it.java.lang.String
getId()
protected void
onRequestReceived(ClassicHttpRequest request)
protected void
onResponseSubmitted(ClassicHttpResponse response)
-
Methods inherited from class org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection
receiveRequestEntity, receiveRequestHeader, sendResponseEntity, sendResponseHeader
-
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
-
LoggingBHttpServerConnection
public LoggingBHttpServerConnection(java.lang.String scheme, Http1Config http1Config, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory, HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory)
-
LoggingBHttpServerConnection
public LoggingBHttpServerConnection(java.lang.String scheme, Http1Config http1Config)
-
-
Method Detail
-
getId
public java.lang.String getId()
- Specified by:
getId
in interfaceIdentifiable
-
close
public void close() throws java.io.IOException
Description copied from interface:HttpConnection
Closes 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. Useshutdown
instead.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceHttpConnection
- Overrides:
close
in classBHttpConnectionBase
- Throws:
java.io.IOException
-
close
public void close(CloseMode closeMode)
Description copied from interface:ModalCloseable
Closes 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:
close
in interfaceModalCloseable
- Overrides:
close
in classBHttpConnectionBase
- Parameters:
closeMode
- How to close the receiver.
-
bind
public void bind(java.net.Socket socket) throws java.io.IOException
Description copied from class:BHttpConnectionBase
Binds 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:
bind
in classDefaultBHttpServerConnection
- Parameters:
socket
- the socket.- Throws:
java.io.IOException
- in case of an I/O error.
-
onRequestReceived
protected void onRequestReceived(ClassicHttpRequest request)
- Overrides:
onRequestReceived
in classDefaultBHttpServerConnection
-
onResponseSubmitted
protected void onResponseSubmitted(ClassicHttpResponse response)
- Overrides:
onResponseSubmitted
in classDefaultBHttpServerConnection
-
-