org.apache.hc.core5.http.io

## Interface HttpServerConnection

- All Superinterfaces:
    AutoCloseable, BHttpConnection, Closeable, HttpConnection, ModalCloseable, SocketModalCloseable
  All Known Implementing Classes:
    DefaultBHttpServerConnection, LoggingBHttpServerConnection

      public interface HttpServerConnection
      extends BHttpConnection

  A server-side HTTP connection, which can be used for receiving requests and sending responses.
  Since:
    4.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `receiveRequestEntity(ClassicHttpRequest request)` Receives the next request entity available from this connection and attaches it to an existing request.
    `ClassicHttpRequest` | `receiveRequestHeader()` Receives the request line and all headers available from this connection.
    `void` | `sendResponseEntity(ClassicHttpResponse response)` Sends the response entity of a response over this connection.
    `void` | `sendResponseHeader(ClassicHttpResponse response)` Sends the response line and headers of a response over this connection.

    - ### Methods inherited from interface org.apache.hc.core5.http.io.BHttpConnection

      `flush, isDataAvailable, isStale`

    - ### Methods inherited from interface org.apache.hc.core5.http.HttpConnection

      `close, getEndpointDetails, getLocalAddress, getProtocolVersion, getRemoteAddress, getSSLSession, isOpen`

    - ### Methods inherited from interface org.apache.hc.core5.http.SocketModalCloseable

      `getSocketTimeout, setSocketTimeout`

    - ### Methods inherited from interface org.apache.hc.core5.io.ModalCloseable

      `close`

- - ### Method Detail

    - #### receiveRequestHeader

          ClassicHttpRequest receiveRequestHeader()
                                           throws HttpException,
                                                  IOException

      Receives the request line and all headers available from this connection. The caller should examine the returned request and decide if to receive a request entity as well.
      Returns:
        a new HttpRequest object whose request line and headers are initialized or `null` if the connection has been closed by the opposite endpoint.
      Throws:
        `HttpException` - in case of HTTP protocol violation
        `IOException` - in case of an I/O error

    - #### receiveRequestEntity

          void receiveRequestEntity(ClassicHttpRequest request)
                             throws HttpException,
                                    IOException

      Receives the next request entity available from this connection and attaches it to an existing request.
      Parameters:
        `request` - the request to attach the entity to.
      Throws:
        `HttpException` - in case of HTTP protocol violation
        `IOException` - in case of an I/O error

    - #### sendResponseHeader

          void sendResponseHeader(ClassicHttpResponse response)
                           throws HttpException,
                                  IOException

      Sends the response line and headers of a response over this connection.
      Parameters:
        `response` - the response whose headers to send.
      Throws:
        `HttpException` - in case of HTTP protocol violation
        `IOException` - in case of an I/O error

    - #### sendResponseEntity

          void sendResponseEntity(ClassicHttpResponse response)
                           throws HttpException,
                                  IOException

      Sends the response entity of a response over this connection.
      Parameters:
        `response` - the response whose entity to send.
      Throws:
        `HttpException` - in case of HTTP protocol violation
        `IOException` - in case of an I/O error

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