org.apache.hc.core5.http.impl.nio

## Class ServerHttp1IOEventHandler

- java.lang.Object
- - org.apache.hc.core5.http.impl.nio.ServerHttp1IOEventHandler

- All Implemented Interfaces:
    Closeable, AutoCloseable, HttpConnection, HttpConnectionEventHandler, SocketModalCloseable, ModalCloseable, IOEventHandler

      public class ServerHttp1IOEventHandler
      extends Object

  `IOEventHandler` that implements server side HTTP/1.1 messaging protocol with full support for duplexed message transmission and message pipelining.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerHttp1IOEventHandler(ServerHttp1StreamDuplexer streamDuplexer)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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, Exception cause)` Triggered when the given session throws a exception.
    `EndpointDetails` | `getEndpointDetails()` Returns this connection's endpoint details.
    `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.
    `Timeout` | `getSocketTimeout()` Returns the socket timeout value.
    `SSLSession` | `getSSLSession()` Returns this connection's SSL session or `null` if TLS has not been activated.
    `void` | `inputReady(IOSession session, 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.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ServerHttp1IOEventHandler

          public ServerHttp1IOEventHandler(ServerHttp1StreamDuplexer streamDuplexer)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getProtocolVersion

          public ProtocolVersion getProtocolVersion()

      Description copied from interface: `HttpConnection`
      Returns this connection's protocol version or `null` if unknown.
      Specified by:
        `getProtocolVersion` in interface `HttpConnection`
      Returns:
        this connection's protocol version or `null` if unknown.

    - #### connected

          public void connected(IOSession session)
                         throws IOException

      Description copied from interface: `IOEventHandler`
      Triggered after the given session has been just created.
      Specified by:
        `connected` in interface `IOEventHandler`
      Parameters:
        `session` - the I/O session.
      Throws:
        `IOException` - in case of an I/O error.

    - #### inputReady

          public void inputReady(IOSession session,
                                 ByteBuffer src)
                          throws IOException

      Description copied from interface: `IOEventHandler`
      Triggered when the given session has input pending.
      Specified by:
        `inputReady` in interface `IOEventHandler`
      Parameters:
        `session` - the I/O session.
      Throws:
        `IOException` - in case of an I/O error.

    - #### outputReady

          public void outputReady(IOSession session)
                           throws IOException

      Description copied from interface: `IOEventHandler`
      Triggered when the given session is ready for output.
      Specified by:
        `outputReady` in interface `IOEventHandler`
      Parameters:
        `session` - the I/O session.
      Throws:
        `IOException` - in case of an I/O error.

    - #### timeout

          public void timeout(IOSession session,
                              Timeout timeout)
                       throws IOException

      Description copied from interface: `IOEventHandler`
      Triggered when the given session has timed out.
      Specified by:
        `timeout` in interface `IOEventHandler`
      Parameters:
        `session` - the I/O session.
        `timeout` - the timeout.
      Throws:
        `IOException` - in case of an I/O error.

    - #### exception

          public void exception(IOSession session,
                                Exception cause)

      Description copied from interface: `IOEventHandler`
      Triggered when the given session throws a exception.
      Specified by:
        `exception` in interface `IOEventHandler`
      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 interface `IOEventHandler`
      Parameters:
        `session` - the I/O session.

    - #### close

          public void close()
                     throws 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. Use `shutdown` instead.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `HttpConnection`
      Throws:
        `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 interface `ModalCloseable`
      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 interface `HttpConnection`
      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 interface `SocketModalCloseable`
      Parameters:
        `timeout` - timeout value

    - #### getSSLSession

          public SSLSession getSSLSession()

      Description copied from interface: `HttpConnection`
      Returns this connection's SSL session or `null` if TLS has not been activated.
      Specified by:
        `getSSLSession` in interface `HttpConnection`
      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 interface `HttpConnection`
      Returns:
        this connection's endpoint details.

    - #### getSocketTimeout

          public Timeout getSocketTimeout()

      Description copied from interface: `SocketModalCloseable`
      Returns the socket timeout value.
      Specified by:
        `getSocketTimeout` in interface `SocketModalCloseable`
      Returns:
        timeout value.

    - #### getRemoteAddress

          public SocketAddress getRemoteAddress()

      Description copied from interface: `HttpConnection`
      Returns this connection's remote address or `null` if it is not connected yet or unconnected.
      Specified by:
        `getRemoteAddress` in interface `HttpConnection`
      Returns:
        this connection's remote address or `null` if it is not connected yet or unconnected.

    - #### getLocalAddress

          public SocketAddress getLocalAddress()

      Description copied from interface: `HttpConnection`
      Returns this connection's local address or `null` if it is not bound yet.
      Specified by:
        `getLocalAddress` in interface `HttpConnection`
      Returns:
        this connection's local address or `null` if it is not bound yet.

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.