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 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 voidonRequestReceived(ClassicHttpRequest request)protected voidonResponseSubmitted(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:
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 classDefaultBHttpServerConnection- Parameters:
socket- the socket.- Throws:
java.io.IOException- in case of an I/O error.
-
onRequestReceived
protected void onRequestReceived(ClassicHttpRequest request)
- Overrides:
onRequestReceivedin classDefaultBHttpServerConnection
-
onResponseSubmitted
protected void onResponseSubmitted(ClassicHttpResponse response)
- Overrides:
onResponseSubmittedin classDefaultBHttpServerConnection
-
-