Class AbstractHttp1IOEventHandler
- java.lang.Object
-
- org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,HttpConnection
,HttpConnectionEventHandler
,SocketModalCloseable
,ModalCloseable
,IOEventHandler
- Direct Known Subclasses:
ClientHttp1IOEventHandler
,ServerHttp1IOEventHandler
class AbstractHttp1IOEventHandler extends java.lang.Object implements HttpConnectionEventHandler
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AbstractHttp1StreamDuplexer<?,?>
streamDuplexer
-
Constructor Summary
Constructors Constructor Description AbstractHttp1IOEventHandler(AbstractHttp1StreamDuplexer<?,?> streamDuplexer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this connection gracefully.void
close(CloseMode closeMode)
Closes this process or endpoint and releases any system resources associated with it.void
connected(IOSession session)
Triggered after the given session has been just created.void
disconnected(IOSession session)
Triggered when the given session has been terminated.void
exception(IOSession session, java.lang.Exception cause)
Triggered when the given session throws a exception.EndpointDetails
getEndpointDetails()
Returns this connection's endpoint details.java.net.SocketAddress
getLocalAddress()
Returns this connection's local address ornull
if it is not bound yet.ProtocolVersion
getProtocolVersion()
Returns this connection's protocol version ornull
if unknown.java.net.SocketAddress
getRemoteAddress()
Returns this connection's remote address ornull
if it is not connected yet or unconnected.Timeout
getSocketTimeout()
Returns the socket timeout value.javax.net.ssl.SSLSession
getSSLSession()
Returns this connection's SSL session ornull
if TLS has not been activated.void
inputReady(IOSession session, java.nio.ByteBuffer src)
Triggered when the given session has input pending.boolean
isOpen()
Checks if this connection is open.void
outputReady(IOSession session)
Triggered when the given session is ready for output.void
setSocketTimeout(Timeout timeout)
Sets the socket timeout value.void
timeout(IOSession session, Timeout timeout)
Triggered when the given session has timed out.
-
-
-
Field Detail
-
streamDuplexer
final AbstractHttp1StreamDuplexer<?,?> streamDuplexer
-
-
Constructor Detail
-
AbstractHttp1IOEventHandler
AbstractHttp1IOEventHandler(AbstractHttp1StreamDuplexer<?,?> streamDuplexer)
-
-
Method Detail
-
connected
public void connected(IOSession session) throws java.io.IOException
Description copied from interface:IOEventHandler
Triggered after the given session has been just created.- Specified by:
connected
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
java.io.IOException
-
inputReady
public void inputReady(IOSession session, java.nio.ByteBuffer src) throws java.io.IOException
Description copied from interface:IOEventHandler
Triggered when the given session has input pending.- Specified by:
inputReady
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
java.io.IOException
-
outputReady
public void outputReady(IOSession session) throws java.io.IOException
Description copied from interface:IOEventHandler
Triggered when the given session is ready for output.- Specified by:
outputReady
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
java.io.IOException
-
timeout
public void timeout(IOSession session, Timeout timeout) throws java.io.IOException
Description copied from interface:IOEventHandler
Triggered when the given session has timed out.- Specified by:
timeout
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.timeout
- the timeout.- Throws:
java.io.IOException
-
exception
public void exception(IOSession session, java.lang.Exception cause)
Description copied from interface:IOEventHandler
Triggered when the given session throws a exception.- Specified by:
exception
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.
-
disconnected
public void disconnected(IOSession session)
Description copied from interface:IOEventHandler
Triggered when the given session has been terminated.- Specified by:
disconnected
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.
-
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
- 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
- Parameters:
closeMode
- How to close the receiver.
-
isOpen
public boolean isOpen()
Description copied from interface:HttpConnection
Checks if this connection is open.- Specified by:
isOpen
in interfaceHttpConnection
- Returns:
- true if it is open, false if it is closed.
-
setSocketTimeout
public void setSocketTimeout(Timeout timeout)
Description copied from interface:SocketModalCloseable
Sets the socket timeout value.- Specified by:
setSocketTimeout
in interfaceSocketModalCloseable
- Parameters:
timeout
- timeout value
-
getSSLSession
public javax.net.ssl.SSLSession getSSLSession()
Description copied from interface:HttpConnection
Returns this connection's SSL session ornull
if TLS has not been activated.- Specified by:
getSSLSession
in interfaceHttpConnection
- Returns:
- this connection's SSL session or
null
if TLS has not been activated.
-
getEndpointDetails
public EndpointDetails getEndpointDetails()
Description copied from interface:HttpConnection
Returns this connection's endpoint details.- Specified by:
getEndpointDetails
in interfaceHttpConnection
- Returns:
- this connection's endpoint details.
-
getSocketTimeout
public Timeout getSocketTimeout()
Description copied from interface:SocketModalCloseable
Returns the socket timeout value.- Specified by:
getSocketTimeout
in interfaceSocketModalCloseable
- Returns:
- timeout value.
-
getProtocolVersion
public ProtocolVersion getProtocolVersion()
Description copied from interface:HttpConnection
Returns this connection's protocol version ornull
if unknown.- Specified by:
getProtocolVersion
in interfaceHttpConnection
- Returns:
- this connection's protocol version or
null
if unknown.
-
getRemoteAddress
public java.net.SocketAddress getRemoteAddress()
Description copied from interface:HttpConnection
Returns this connection's remote address ornull
if it is not connected yet or unconnected.- Specified by:
getRemoteAddress
in interfaceHttpConnection
- Returns:
- this connection's remote address or
null
if it is not connected yet or unconnected.
-
getLocalAddress
public java.net.SocketAddress getLocalAddress()
Description copied from interface:HttpConnection
Returns this connection's local address ornull
if it is not bound yet.- Specified by:
getLocalAddress
in interfaceHttpConnection
- Returns:
- this connection's local address or
null
if it is not bound yet.
-
-