Interface Endpoint<A extends ExchangeContext>

Type Parameters:
A - the exchange context type

public interface Endpoint<A extends ExchangeContext>

An endpoint represents the terminal end in an HTTP communication from a client to a server.

It is obtained from the HttpClient and it is bound to an IP Socket Address of an HTTP server. It exposes methods to create HTTP client Exchange used to create and send HTTP requests or open Web sockets.

Since:
1.6
Author:
Jeremy Kuhn
  • Method Details

    • getLocalAddress

      SocketAddress getLocalAddress()

      Returns the local socket address of the endpoint.

      Returns:
      a socket address
    • getRemoteAddress

      SocketAddress getRemoteAddress()

      Returns the remote socket address of the endpoint.

      Returns:
      a socket address
    • exchange

      default Mono<? extends Exchange<A>> exchange()

      Creates an HTTP exchange.

      This method is a shortcut for exchange(Method.GET, "/", null).

      Returns:
      an HTTP exchange mono
    • exchange

      default Mono<? extends Exchange<A>> exchange(A context)

      Creates an HTTP exchange.

      This method is a shortcut for exchange(Method.GET, "/", context).

      Parameters:
      context - the exchange context
      Returns:
      an HTTP exchange mono
    • exchange

      default Mono<? extends Exchange<A>> exchange(String requestTarget)

      Creates an HTTP exchange.

      This method is a shortcut for exchange(Method.GET, requestTarget, null).

      Parameters:
      requestTarget - the request target path
      Returns:
      an HTTP exchange mono
    • exchange

      default Mono<? extends Exchange<A>> exchange(Method method, String requestTarget)

      Creates an HTTP exchange.

      This method is a shortcut for exchange(method, requestTarget, null).

      Parameters:
      method - the HTTP method
      requestTarget - the request target path
      Returns:
      an HTTP exchange mono
    • exchange

      Mono<? extends Exchange<A>> exchange(Method method, String requestTarget, A context)

      Creates an HTTP exchange with a context.

      Parameters:
      method - the HTTP method
      requestTarget - the request target path
      context - the exchange context
      Returns:
      an HTTP exchange mono
    • shutdown

      Mono<Void> shutdown()

      Shutdowns the endpoint right away.

      This is a hard shutdown that closes all active connections right away.

      Note that detached connections (e.g. WebSocket) are not considered here and must be closed individually.

      Returns:
      a mono which completes once the endpoint is shutdown
    • shutdownGracefully

      Mono<Void> shutdownGracefully()

      Gracefully shutdowns the endpoint.

      This is a graceful shutdown that waits for all active exchanges to complete before shutting down the connections.

      Note that detached connections (e.g. WebSocket) are not considered here and must be closed individually.

      Returns:
      a mono which completes once the endpoint is shutdown
      See Also: