public class LoggingBHttpServerConnection extends DefaultBHttpServerConnection implements Identifiable
Constructor and Description |
---|
LoggingBHttpServerConnection(String scheme,
Http1Config http1Config) |
LoggingBHttpServerConnection(String scheme,
Http1Config http1Config,
CharsetDecoder charDecoder,
CharsetEncoder charEncoder,
ContentLengthStrategy incomingContentStrategy,
ContentLengthStrategy outgoingContentStrategy,
HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory,
HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
awaitInput(Timeout timeout) |
void |
bind(Socket socket)
Binds this connection to the given
Socket . |
protected void |
bind(SocketHolder socketHolder) |
void |
bind(SSLSocket sslSocket,
Socket baseSocket) |
void |
close()
Closes this connection gracefully.
|
void |
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated
with it.
|
protected InputStream |
createContentInputStream(long len,
SessionInputBuffer buffer,
InputStream inputStream) |
protected OutputStream |
createContentOutputStream(long len,
SessionOutputBuffer buffer,
OutputStream outputStream,
Supplier<List<? extends Header>> trailers) |
protected SocketHolder |
ensureOpen() |
void |
flush()
Writes out all pending buffered data over the open connection.
|
EndpointDetails |
getEndpointDetails()
Returns this connection's endpoint details.
|
String |
getId() |
SocketAddress |
getLocalAddress()
Returns this connection's local address or
null if it is not bound yet. |
ProtocolVersion |
getProtocolVersion()
Returns this connection's protocol version or
null if unknown. |
SocketAddress |
getRemoteAddress()
Returns this connection's remote address or
null if it is not connected yet or
unconnected. |
protected SocketHolder |
getSocketHolder() |
Timeout |
getSocketTimeout()
Returns the socket timeout value.
|
SSLSession |
getSSLSession()
Returns this connection's SSL session or
null if TLS has not been activated. |
protected void |
incrementRequestCount() |
protected void |
incrementResponseCount() |
boolean |
isDataAvailable(Timeout timeout)
Checks if input data is available from the connection.
|
boolean |
isOpen()
Checks if this connection is open.
|
boolean |
isStale()
Checks whether this connection has gone down.
|
protected void |
onRequestReceived(ClassicHttpRequest request) |
protected void |
onResponseSubmitted(ClassicHttpResponse response) |
void |
setSocketTimeout(Timeout timeout)
Sets the socket timeout value.
|
String |
toString() |
receiveRequestEntity, receiveRequestHeader, sendResponseEntity, sendResponseHeader
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
flush, isDataAvailable, isStale
getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, getSSLSession, isOpen
getSocketTimeout, setSocketTimeout
public LoggingBHttpServerConnection(String scheme, Http1Config http1Config, CharsetDecoder charDecoder, CharsetEncoder charEncoder, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageParserFactory<ClassicHttpRequest> requestParserFactory, HttpMessageWriterFactory<ClassicHttpResponse> responseWriterFactory)
public LoggingBHttpServerConnection(String scheme, Http1Config http1Config)
public String getId()
getId
in interface Identifiable
public void close() throws IOException
HttpConnection
shutdown
instead.close
in interface Closeable
close
in interface AutoCloseable
close
in interface HttpConnection
IOException
public void close(CloseMode closeMode)
ModalCloseable
close
in interface ModalCloseable
closeMode
- How to close the receiver.public void bind(Socket socket) throws IOException
Socket
. 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 isOpen()
will return true
.
bind
in class DefaultBHttpServerConnection
socket
- the socket.IOException
- in case of an I/O error.public void bind(SSLSocket sslSocket, Socket baseSocket) throws IOException
bind
in class DefaultBHttpServerConnection
IOException
protected void onRequestReceived(ClassicHttpRequest request)
onRequestReceived
in class DefaultBHttpServerConnection
protected void onResponseSubmitted(ClassicHttpResponse response)
onResponseSubmitted
in class DefaultBHttpServerConnection
protected SocketHolder ensureOpen() throws IOException
IOException
protected void bind(SocketHolder socketHolder) throws IOException
IOException
public boolean isOpen()
HttpConnection
isOpen
in interface HttpConnection
public ProtocolVersion getProtocolVersion()
HttpConnection
null
if unknown.getProtocolVersion
in interface HttpConnection
null
if unknown.protected SocketHolder getSocketHolder()
protected OutputStream createContentOutputStream(long len, SessionOutputBuffer buffer, OutputStream outputStream, Supplier<List<? extends Header>> trailers)
protected InputStream createContentInputStream(long len, SessionInputBuffer buffer, InputStream inputStream)
public SocketAddress getRemoteAddress()
HttpConnection
null
if it is not connected yet or
unconnected.getRemoteAddress
in interface HttpConnection
null
if it is not connected yet or
unconnected.public SocketAddress getLocalAddress()
HttpConnection
null
if it is not bound yet.getLocalAddress
in interface HttpConnection
null
if it is not bound yet.public void setSocketTimeout(Timeout timeout)
SocketModalCloseable
setSocketTimeout
in interface SocketModalCloseable
timeout
- timeout valuepublic Timeout getSocketTimeout()
SocketModalCloseable
getSocketTimeout
in interface SocketModalCloseable
protected boolean awaitInput(Timeout timeout) throws IOException
IOException
public boolean isDataAvailable(Timeout timeout) throws IOException
BHttpConnection
isDataAvailable
in interface BHttpConnection
timeout
- the maximum time to wait for datatimeout
.IOException
- if an error happens on the connectionpublic boolean isStale() throws IOException
BHttpConnection
isStale
in interface BHttpConnection
true
if attempts to use this connection are likely
to fail and this connection should be closed,
or false
if they are likely to succeedIOException
public void flush() throws IOException
BHttpConnection
flush
in interface BHttpConnection
IOException
- in case of an I/O errorprotected void incrementRequestCount()
protected void incrementResponseCount()
public SSLSession getSSLSession()
HttpConnection
null
if TLS has not been activated.getSSLSession
in interface HttpConnection
null
if TLS has not been activated.public EndpointDetails getEndpointDetails()
HttpConnection
getEndpointDetails
in interface HttpConnection
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.