Interface Endpoint<A extends ExchangeContext>
- Type Parameters:
A
- the exchange context type
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 Summary
Modifier and TypeMethodDescriptionexchange()
Creates an HTTP exchange.Creates an HTTP exchange.Creates an HTTP exchange.Creates an HTTP exchange with a context.Creates an HTTP exchange.Returns the local socket address of the endpoint.Returns the remote socket address of the endpoint.shutdown()
Shutdowns the endpoint right away.Gracefully shutdowns the endpoint.
-
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
Creates an HTTP exchange.
This method is a shortcut for
exchange(Method.GET, "/", null)
.- Returns:
- an HTTP exchange mono
-
exchange
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
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
Creates an HTTP exchange.
This method is a shortcut for
exchange(method, requestTarget, null)
.- Parameters:
method
- the HTTP methodrequestTarget
- the request target path- Returns:
- an HTTP exchange mono
-
exchange
Creates an HTTP exchange with a context.
- Parameters:
method
- the HTTP methodrequestTarget
- the request target pathcontext
- the exchange context- Returns:
- an HTTP exchange mono
-
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
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:
-