public class Http
extends java.lang.Object
implements org.apache.pekko.actor.Extension
| Constructor and Description |
|---|
Http(org.apache.pekko.actor.ExtendedActorSystem system) |
| Modifier and Type | Method and Description |
|---|---|
static T |
apply(org.apache.pekko.actor.ActorSystem system) |
static T |
apply(org.apache.pekko.actor.ClassicActorSystemProvider system) |
org.apache.pekko.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> |
bind(ConnectHttp connect)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).connectionSource() instead
|
org.apache.pekko.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> |
bind(ConnectHttp connect,
ServerSettings settings)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).connectionSource() instead
|
org.apache.pekko.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> |
bind(ConnectHttp connect,
ServerSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).connectionSource() instead
|
java.util.concurrent.CompletionStage<ServerBinding> |
bindAndHandle(org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handler,
ConnectHttp connect,
org.apache.pekko.stream.Materializer materializer)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).bindFlow(handler) instead.
|
java.util.concurrent.CompletionStage<ServerBinding> |
bindAndHandle(org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handler,
ConnectHttp connect,
ServerSettings settings,
org.apache.pekko.event.LoggingAdapter log,
org.apache.pekko.stream.Materializer materializer)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).bindFlow(handler) instead.
|
java.util.concurrent.CompletionStage<ServerBinding> |
bindAndHandleAsync(org.apache.pekko.japi.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> handler,
ConnectHttp connect,
org.apache.pekko.stream.Materializer materializer)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).bind(handler) instead
|
java.util.concurrent.CompletionStage<ServerBinding> |
bindAndHandleAsync(org.apache.pekko.japi.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> handler,
ConnectHttp connect,
ServerSettings settings,
int parallelism,
org.apache.pekko.event.LoggingAdapter log,
org.apache.pekko.stream.Materializer materializer)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).bind(handler) instead
|
java.util.concurrent.CompletionStage<ServerBinding> |
bindAndHandleSync(org.apache.pekko.japi.Function<HttpRequest,HttpResponse> handler,
ConnectHttp connect,
org.apache.pekko.stream.Materializer materializer)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).bindSync(handler) instead
|
java.util.concurrent.CompletionStage<ServerBinding> |
bindAndHandleSync(org.apache.pekko.japi.Function<HttpRequest,HttpResponse> handler,
ConnectHttp connect,
ServerSettings settings,
org.apache.pekko.event.LoggingAdapter log,
org.apache.pekko.stream.Materializer materializer)
Deprecated.
since Akka HTTP 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).bindSync(handler) instead
|
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
cachedHostConnectionPool(ConnectHttp to)
Returns a
pekko.stream.javadsl.Flow which dispatches incoming HTTP requests to the per-ActorSystem pool of outgoing
HTTP connections to the given target host endpoint. |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
cachedHostConnectionPool(ConnectHttp to,
ConnectionPoolSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Returns a
pekko.stream.javadsl.Flow which dispatches incoming HTTP requests to the per-ActorSystem pool of outgoing
HTTP connections to the given target host endpoint. |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
cachedHostConnectionPool(java.lang.String host)
Returns a
pekko.stream.javadsl.Flow which dispatches incoming HTTP requests to the per-ActorSystem pool of outgoing
HTTP connections to the given target host endpoint. |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
cachedHostConnectionPoolHttps(ConnectHttp to)
Same as
cachedHostConnectionPool but with HTTPS encryption. |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
cachedHostConnectionPoolHttps(ConnectHttp to,
ConnectionPoolSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Same as
cachedHostConnectionPool but with HTTPS encryption. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpRequest,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpResponse,org.apache.pekko.NotUsed> |
clientLayer(Host hostHeader)
Constructs a client layer stage using the configured default
pekko.http.javadsl.settings.ClientConnectionSettings. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpRequest,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpResponse,org.apache.pekko.NotUsed> |
clientLayer(Host hostHeader,
ClientConnectionSettings settings)
Constructs a client layer stage using the given
pekko.http.javadsl.settings.ClientConnectionSettings. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpRequest,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpResponse,org.apache.pekko.NotUsed> |
clientLayer(Host hostHeader,
ClientConnectionSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Constructs a client layer stage using the given
ClientConnectionSettings. |
OutgoingConnectionBuilder |
connectionTo(java.lang.String host)
Creates a builder which will create a single connection to a host every time the built flow is materialized.
|
HttpsConnectionContext |
createClientHttpsContext(com.typesafe.sslconfig.pekko.PekkoSSLConfig sslConfig)
Deprecated.
use ConnectionContext.httpsClient. Since Akka HTTP 10.2.0.
|
HttpsConnectionContext |
createDefaultClientHttpsContext()
Deprecated.
use ConnectionContext.httpsClient. Since Akka HTTP 10.2.0.
|
static Http |
createExtension(org.apache.pekko.actor.ExtendedActorSystem system) |
HttpsConnectionContext |
createServerHttpsContext(com.typesafe.sslconfig.pekko.PekkoSSLConfig sslConfig)
Deprecated.
use ConnectionContext.httpsServer. Since Akka HTTP 10.2.0.
|
HttpsConnectionContext |
defaultClientHttpsContext()
Gets the current default client-side
ConnectionContext. |
ConnectionContext |
defaultServerHttpContext()
Deprecated.
since Akka HTTP 10.2.0: set context explicitly when binding
|
static boolean |
equals(java.lang.Object other) |
static Http |
get(org.apache.pekko.actor.ActorSystem system) |
static Http |
get(org.apache.pekko.actor.ClassicActorSystemProvider system) |
static int |
hashCode() |
static Http$ |
lookup() |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
newHostConnectionPool(ConnectHttp to,
ConnectionPoolSettings settings,
org.apache.pekko.event.LoggingAdapter log,
org.apache.pekko.stream.Materializer materializer)
Same as
newHostConnectionPool but with HTTPS encryption. |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
newHostConnectionPool(ConnectHttp to,
org.apache.pekko.stream.Materializer materializer)
Starts a new connection pool to the given host and configuration and returns a
pekko.stream.javadsl.Flow which dispatches
the requests from all its materializations across this pool. |
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> |
newHostConnectionPool(java.lang.String host,
org.apache.pekko.stream.Materializer materializer)
Starts a new connection pool to the given host and configuration and returns a
pekko.stream.javadsl.Flow which dispatches
the requests from all its materializations across this pool. |
ServerBuilder |
newServerAt(java.lang.String interface_,
int port)
Main entry point to create a server binding.
|
org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,java.util.concurrent.CompletionStage<OutgoingConnection>> |
outgoingConnection(ConnectHttp to)
Creates a
pekko.stream.javadsl.Flow representing a prospective HTTP client connection to the given endpoint. |
org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,java.util.concurrent.CompletionStage<OutgoingConnection>> |
outgoingConnection(ConnectHttp to,
java.util.Optional<java.net.InetSocketAddress> localAddress,
ClientConnectionSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Creates a
pekko.stream.javadsl.Flow representing a prospective HTTP client connection to the given endpoint. |
org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,java.util.concurrent.CompletionStage<OutgoingConnection>> |
outgoingConnection(java.lang.String host)
Creates a
pekko.stream.javadsl.Flow representing a prospective HTTP client connection to the given endpoint. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> |
serverLayer()
Constructs a server layer stage using the configured default
pekko.http.javadsl.settings.ServerSettings. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> |
serverLayer(ServerSettings settings)
Constructs a server layer stage using the given
pekko.http.javadsl.settings.ServerSettings. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> |
serverLayer(ServerSettings settings,
java.util.Optional<java.net.InetSocketAddress> remoteAddress)
Constructs a server layer stage using the given
pekko.http.javadsl.settings.ServerSettings. |
org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> |
serverLayer(ServerSettings settings,
java.util.Optional<java.net.InetSocketAddress> remoteAddress,
org.apache.pekko.event.LoggingAdapter log)
Constructs a server layer stage using the given
ServerSettings. |
void |
setDefaultClientHttpsContext(HttpsConnectionContext context)
Sets the default client-side
ConnectionContext. |
void |
setDefaultServerHttpContext(ConnectionContext context)
Deprecated.
since Akka HTTP 10.2.0: set context explicitly when binding
|
java.util.concurrent.CompletionStage<scala.runtime.BoxedUnit> |
shutdownAllConnectionPools()
Triggers an orderly shutdown of all host connections pools currently maintained by the
pekko.actor.ActorSystem. |
java.util.concurrent.CompletionStage<HttpResponse> |
singleRequest(HttpRequest request)
Fires a single
HttpRequest across the (cached) host connection pool for the request's
effective URI to produce a response future. |
java.util.concurrent.CompletionStage<HttpResponse> |
singleRequest(HttpRequest request,
HttpsConnectionContext connectionContext)
Fires a single
HttpRequest across the (cached) host connection pool for the request's
effective URI to produce a response future. |
java.util.concurrent.CompletionStage<HttpResponse> |
singleRequest(HttpRequest request,
HttpsConnectionContext connectionContext,
ConnectionPoolSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Fires a single
HttpRequest across the (cached) host connection pool for the request's
effective URI to produce a response future. |
<T> org.apache.pekko.japi.Pair<java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>,T> |
singleWebSocketRequest(WebSocketRequest request,
org.apache.pekko.stream.javadsl.Flow<Message,Message,T> clientFlow,
ConnectionContext connectionContext,
org.apache.pekko.stream.Materializer materializer)
Runs a single WebSocket conversation given a Uri and a flow that represents the client side of the
WebSocket conversation.
|
<T> org.apache.pekko.japi.Pair<java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>,T> |
singleWebSocketRequest(WebSocketRequest request,
org.apache.pekko.stream.javadsl.Flow<Message,Message,T> clientFlow,
ConnectionContext connectionContext,
java.util.Optional<java.net.InetSocketAddress> localAddress,
ClientConnectionSettings settings,
org.apache.pekko.event.LoggingAdapter log,
org.apache.pekko.stream.Materializer materializer)
Runs a single WebSocket conversation given a Uri and a flow that represents the client side of the
WebSocket conversation.
|
<T> org.apache.pekko.japi.Pair<java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>,T> |
singleWebSocketRequest(WebSocketRequest request,
org.apache.pekko.stream.javadsl.Flow<Message,Message,T> clientFlow,
org.apache.pekko.stream.Materializer materializer)
Runs a single WebSocket conversation given a Uri and a flow that represents the client side of the
WebSocket conversation.
|
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,org.apache.pekko.NotUsed> |
superPool()
Creates a new "super connection pool flow", which routes incoming requests to a (cached) host connection pool
depending on their respective effective URIs.
|
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,org.apache.pekko.NotUsed> |
superPool(ConnectionPoolSettings settings,
HttpsConnectionContext connectionContext,
org.apache.pekko.event.LoggingAdapter log)
Creates a new "super connection pool flow", which routes incoming requests to a (cached) host connection pool
depending on their respective effective URIs.
|
<T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,org.apache.pekko.NotUsed> |
superPool(ConnectionPoolSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Creates a new "super connection pool flow", which routes incoming requests to a (cached) host connection pool
depending on their respective effective URIs.
|
org.apache.pekko.stream.javadsl.Flow<Message,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> |
webSocketClientFlow(WebSocketRequest request)
Constructs a flow that once materialized establishes a WebSocket connection to the given Uri.
|
org.apache.pekko.stream.javadsl.Flow<Message,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> |
webSocketClientFlow(WebSocketRequest request,
ConnectionContext connectionContext,
java.util.Optional<java.net.InetSocketAddress> localAddress,
ClientConnectionSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Constructs a flow that once materialized establishes a WebSocket connection to the given Uri.
|
org.apache.pekko.stream.javadsl.BidiFlow<Message,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> |
webSocketClientLayer(WebSocketRequest request)
Constructs a WebSocket
pekko.stream.javadsl.BidiFlow. |
org.apache.pekko.stream.javadsl.BidiFlow<Message,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> |
webSocketClientLayer(WebSocketRequest request,
ClientConnectionSettings settings)
Constructs a WebSocket
pekko.stream.javadsl.BidiFlow using the configured default ClientConnectionSettings,
configured using the pekko.http.client config section. |
org.apache.pekko.stream.javadsl.BidiFlow<Message,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> |
webSocketClientLayer(WebSocketRequest request,
ClientConnectionSettings settings,
org.apache.pekko.event.LoggingAdapter log)
Constructs a WebSocket
pekko.stream.javadsl.BidiFlow using the configured default ClientConnectionSettings,
configured using the pekko.http.client config section. |
public static Http get(org.apache.pekko.actor.ActorSystem system)
public static Http get(org.apache.pekko.actor.ClassicActorSystemProvider system)
public static Http$ lookup()
public static Http createExtension(org.apache.pekko.actor.ExtendedActorSystem system)
public static T apply(org.apache.pekko.actor.ActorSystem system)
public static T apply(org.apache.pekko.actor.ClassicActorSystemProvider system)
public static final int hashCode()
public static final boolean equals(java.lang.Object other)
public org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> serverLayer()
pekko.http.javadsl.settings.ServerSettings. The returned pekko.stream.javadsl.BidiFlow isn't
reusable and can only be materialized once.public org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> serverLayer(ServerSettings settings)
pekko.http.javadsl.settings.ServerSettings. The returned pekko.stream.javadsl.BidiFlow isn't reusable and
can only be materialized once.settings - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> serverLayer(ServerSettings settings, java.util.Optional<java.net.InetSocketAddress> remoteAddress)
pekko.http.javadsl.settings.ServerSettings. The returned pekko.stream.javadsl.BidiFlow isn't reusable and
can only be materialized once. The remoteAddress, if provided, will be added as a header to each HttpRequest
this layer produces if the pekko.http.server.remote-address-header configuration option is enabled.settings - (undocumented)remoteAddress - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,org.apache.pekko.NotUsed> serverLayer(ServerSettings settings, java.util.Optional<java.net.InetSocketAddress> remoteAddress, org.apache.pekko.event.LoggingAdapter log)
ServerSettings. The returned pekko.stream.javadsl.BidiFlow isn't reusable and
can only be materialized once. The remoteAddress, if provided, will be added as a header to each HttpRequest
this layer produces if the pekko.http.server.remote-address-header configuration option is enabled.settings - (undocumented)remoteAddress - (undocumented)log - (undocumented)public ServerBuilder newServerAt(java.lang.String interface_, int port)
interface - The interface to bind to.port - The port to bind to or 0 if the port should be automatically assigned.interface_ - (undocumented)public org.apache.pekko.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> bind(ConnectHttp connect)
pekko.stream.javadsl.Source of IncomingConnection instances which represents a prospective HTTP server binding
on the given endpoint.
If the given port is 0 the resulting source can be materialized several times. Each materialization will
then be assigned a new local port by the operating system, which can then be retrieved by the materialized
ServerBinding.
If the given port is non-zero subsequent materialization attempts of the produced source will immediately
fail, unless the first materialization has already been unbound. Unbinding can be triggered via the materialized
ServerBinding.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
connect - (undocumented)public org.apache.pekko.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> bind(ConnectHttp connect, ServerSettings settings)
pekko.stream.javadsl.Source of IncomingConnection instances which represents a prospective HTTP server binding
on the given endpoint.
If the given port is 0 the resulting source can be materialized several times. Each materialization will
then be assigned a new local port by the operating system, which can then be retrieved by the materialized
ServerBinding.
If the given port is non-zero subsequent materialization attempts of the produced source will immediately
fail, unless the first materialization has already been unbound. Unbinding can be triggered via the materialized
ServerBinding.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
connect - (undocumented)settings - (undocumented)public org.apache.pekko.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> bind(ConnectHttp connect, ServerSettings settings, org.apache.pekko.event.LoggingAdapter log)
pekko.stream.javadsl.Source of IncomingConnection instances which represents a prospective HTTP server binding
on the given endpoint.
If the given port is 0 the resulting source can be materialized several times. Each materialization will
then be assigned a new local port by the operating system, which can then be retrieved by the materialized
ServerBinding.
If the given port is non-zero subsequent materialization attempts of the produced source will immediately
fail, unless the first materialization has already been unbound. Unbinding can be triggered via the materialized
ServerBinding.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
connect - (undocumented)settings - (undocumented)log - (undocumented)public java.util.concurrent.CompletionStage<ServerBinding> bindAndHandle(org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handler, ConnectHttp connect, org.apache.pekko.stream.Materializer materializer)
handler
pekko.stream.javadsl.Flow for processing all incoming connections.
The number of concurrently accepted connections can be configured by overriding
the pekko.http.server.max-connections setting. Please see the documentation in the reference.conf for more
information about what kind of guarantees to expect.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
handler - (undocumented)connect - (undocumented)materializer - (undocumented)public java.util.concurrent.CompletionStage<ServerBinding> bindAndHandle(org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handler, ConnectHttp connect, ServerSettings settings, org.apache.pekko.event.LoggingAdapter log, org.apache.pekko.stream.Materializer materializer)
handler
pekko.stream.javadsl.Flow for processing all incoming connections.
The number of concurrently accepted connections can be configured by overriding
the pekko.http.server.max-connections setting. Please see the documentation in the reference.conf for more
information about what kind of guarantees to expect.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
handler - (undocumented)connect - (undocumented)settings - (undocumented)log - (undocumented)materializer - (undocumented)public java.util.concurrent.CompletionStage<ServerBinding> bindAndHandleSync(org.apache.pekko.japi.Function<HttpRequest,HttpResponse> handler, ConnectHttp connect, org.apache.pekko.stream.Materializer materializer)
handler
function for processing all incoming connections.
The number of concurrently accepted connections can be configured by overriding
the pekko.http.server.max-connections setting. Please see the documentation in the reference.conf for more
information about what kind of guarantees to expect.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
handler - (undocumented)connect - (undocumented)materializer - (undocumented)public java.util.concurrent.CompletionStage<ServerBinding> bindAndHandleSync(org.apache.pekko.japi.Function<HttpRequest,HttpResponse> handler, ConnectHttp connect, ServerSettings settings, org.apache.pekko.event.LoggingAdapter log, org.apache.pekko.stream.Materializer materializer)
handler
function for processing all incoming connections.
The number of concurrently accepted connections can be configured by overriding
the pekko.http.server.max-connections setting. Please see the documentation in the reference.conf for more
information about what kind of guarantees to expect.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
handler - (undocumented)connect - (undocumented)settings - (undocumented)log - (undocumented)materializer - (undocumented)public java.util.concurrent.CompletionStage<ServerBinding> bindAndHandleAsync(org.apache.pekko.japi.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> handler, ConnectHttp connect, org.apache.pekko.stream.Materializer materializer)
handler
function for processing all incoming connections.
The number of concurrently accepted connections can be configured by overriding
the pekko.http.server.max-connections setting. Please see the documentation in the reference.conf for more
information about what kind of guarantees to expect.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
handler - (undocumented)connect - (undocumented)materializer - (undocumented)public java.util.concurrent.CompletionStage<ServerBinding> bindAndHandleAsync(org.apache.pekko.japi.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> handler, ConnectHttp connect, ServerSettings settings, int parallelism, org.apache.pekko.event.LoggingAdapter log, org.apache.pekko.stream.Materializer materializer)
handler
function for processing all incoming connections.
The number of concurrently accepted connections can be configured by overriding
the pekko.http.server.max-connections setting. Please see the documentation in the reference.conf for more
information about what kind of guarantees to expect.
The server will be bound using HTTPS if the ConnectHttp object is configured with an HttpsConnectionContext,
or the defaultServerHttpContext has been configured to be an HttpsConnectionContext.
handler - (undocumented)connect - (undocumented)settings - (undocumented)parallelism - (undocumented)log - (undocumented)materializer - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<HttpRequest,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpResponse,org.apache.pekko.NotUsed> clientLayer(Host hostHeader)
pekko.http.javadsl.settings.ClientConnectionSettings.hostHeader - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<HttpRequest,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpResponse,org.apache.pekko.NotUsed> clientLayer(Host hostHeader, ClientConnectionSettings settings)
pekko.http.javadsl.settings.ClientConnectionSettings.hostHeader - (undocumented)settings - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<HttpRequest,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpResponse,org.apache.pekko.NotUsed> clientLayer(Host hostHeader, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log)
ClientConnectionSettings.hostHeader - (undocumented)settings - (undocumented)log - (undocumented)public org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,java.util.concurrent.CompletionStage<OutgoingConnection>> outgoingConnection(java.lang.String host)
pekko.stream.javadsl.Flow representing a prospective HTTP client connection to the given endpoint.
Every materialization of the produced flow will attempt to establish a new outgoing connection.
If the hostname is given with an https:// prefix, the default HttpsConnectionContext will be used.
Prefer connectionTo over this method.
host - (undocumented)public org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,java.util.concurrent.CompletionStage<OutgoingConnection>> outgoingConnection(ConnectHttp to)
pekko.stream.javadsl.Flow representing a prospective HTTP client connection to the given endpoint.
Every materialization of the produced flow will attempt to establish a new outgoing connection.
Use the ConnectHttp DSL to configure target host and whether HTTPS should be used.
Prefer connectionTo over this method.
to - (undocumented)public org.apache.pekko.stream.javadsl.Flow<HttpRequest,HttpResponse,java.util.concurrent.CompletionStage<OutgoingConnection>> outgoingConnection(ConnectHttp to, java.util.Optional<java.net.InetSocketAddress> localAddress, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log)
pekko.stream.javadsl.Flow representing a prospective HTTP client connection to the given endpoint.
Every materialization of the produced flow will attempt to establish a new outgoing connection.
Prefer connectionTo over this method.
to - (undocumented)localAddress - (undocumented)settings - (undocumented)log - (undocumented)public OutgoingConnectionBuilder connectionTo(java.lang.String host)
singleRequest()
host - (undocumented)Flow>Request, Response, CompletionStage>OutgoingConnection>>.public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> newHostConnectionPool(java.lang.String host, org.apache.pekko.stream.Materializer materializer)
pekko.stream.javadsl.Flow which dispatches
the requests from all its materializations across this pool.
While the started host connection pool internally shuts itself down automatically after the configured idle
timeout it will spin itself up again if more requests arrive from an existing or a new client flow
materialization. The returned flow therefore remains usable for the full lifetime of the application.
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
host - (undocumented)materializer - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> newHostConnectionPool(ConnectHttp to, org.apache.pekko.stream.Materializer materializer)
pekko.stream.javadsl.Flow which dispatches
the requests from all its materializations across this pool.
While the started host connection pool internally shuts itself down automatically after the configured idle
timeout it will spin itself up again if more requests arrive from an existing or a new client flow
materialization. The returned flow therefore remains usable for the full lifetime of the application.
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
to - (undocumented)materializer - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> newHostConnectionPool(ConnectHttp to, ConnectionPoolSettings settings, org.apache.pekko.event.LoggingAdapter log, org.apache.pekko.stream.Materializer materializer)
newHostConnectionPool but with HTTPS encryption.
The given ConnectionContext will be used for encryption on the connection.
to - (undocumented)settings - (undocumented)log - (undocumented)materializer - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPool(java.lang.String host)
pekko.stream.javadsl.Flow which dispatches incoming HTTP requests to the per-ActorSystem pool of outgoing
HTTP connections to the given target host endpoint. For every ActorSystem, target host and pool
configuration a separate connection pool is maintained.
The HTTP layer transparently manages idle shutdown and restarting of connections pools as configured.
The returned pekko.stream.javadsl.Flow instances therefore remain valid throughout the lifetime of the application.
The internal caching logic guarantees that there will never be more than a single pool running for the given target host endpoint and configuration (in this ActorSystem).
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
host - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPool(ConnectHttp to)
pekko.stream.javadsl.Flow which dispatches incoming HTTP requests to the per-ActorSystem pool of outgoing
HTTP connections to the given target host endpoint. For every ActorSystem, target host and pool
configuration a separate connection pool is maintained.
The HTTP layer transparently manages idle shutdown and restarting of connections pools as configured.
The returned pekko.stream.javadsl.Flow instances therefore remain valid throughout the lifetime of the application.
The internal caching logic guarantees that there will never be more than a single pool running for the given target host endpoint and configuration (in this ActorSystem).
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
to - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPool(ConnectHttp to, ConnectionPoolSettings settings, org.apache.pekko.event.LoggingAdapter log)
pekko.stream.javadsl.Flow which dispatches incoming HTTP requests to the per-ActorSystem pool of outgoing
HTTP connections to the given target host endpoint. For every ActorSystem, target host and pool
configuration a separate connection pool is maintained.
The HTTP layer transparently manages idle shutdown and restarting of connections pools as configured.
The returned pekko.stream.javadsl.Flow instances therefore remain valid throughout the lifetime of the application.
The internal caching logic guarantees that there will never be more than a single pool running for the given target host endpoint and configuration (in this ActorSystem).
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
To configure additional settings for the pool (and requests made using it),
use the pekko.http.host-connection-pool config section or pass in a ConnectionPoolSettings explicitly.
to - (undocumented)settings - (undocumented)log - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPoolHttps(ConnectHttp to, ConnectionPoolSettings settings, org.apache.pekko.event.LoggingAdapter log)
cachedHostConnectionPool but with HTTPS encryption.
When an HttpConnectionContext is defined in the given ConnectHttp it will be used, otherwise the default client-side context will be used.
to - (undocumented)settings - (undocumented)log - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPoolHttps(ConnectHttp to)
cachedHostConnectionPool but with HTTPS encryption.
When an HttpConnectionContext is defined in the given ConnectHttp it will be used, otherwise the default client-side context will be used.
to - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,org.apache.pekko.NotUsed> superPool()
Host header.
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,org.apache.pekko.NotUsed> superPool(ConnectionPoolSettings settings, HttpsConnectionContext connectionContext, org.apache.pekko.event.LoggingAdapter log)
Host header.
The given HttpsConnectionContext is used to configure TLS for the connection.
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
settings - (undocumented)connectionContext - (undocumented)log - (undocumented)public <T> org.apache.pekko.stream.javadsl.Flow<org.apache.pekko.japi.Pair<HttpRequest,T>,org.apache.pekko.japi.Pair<scala.util.Try<HttpResponse>,T>,org.apache.pekko.NotUsed> superPool(ConnectionPoolSettings settings, org.apache.pekko.event.LoggingAdapter log)
Host header.
The defaultClientHttpsContext is used to configure TLS for the connection.
Since the underlying transport usually comprises more than a single connection the produced flow might generate
responses in an order that doesn't directly match the consumed requests.
For example, if two requests A and B enter the flow in that order the response for B might be produced before the
response for A.
In order to allow for easy response-to-request association the flow takes in a custom, opaque context
object of type T from the application which is emitted together with the corresponding response.
settings - (undocumented)log - (undocumented)public java.util.concurrent.CompletionStage<HttpResponse> singleRequest(HttpRequest request)
HttpRequest across the (cached) host connection pool for the request's
effective URI to produce a response future.
The defaultClientHttpsContext is used to configure TLS for the connection.
Note that the request must have either an absolute URI or a valid Host header, otherwise
the future will be completed with an error.
request - (undocumented)public java.util.concurrent.CompletionStage<HttpResponse> singleRequest(HttpRequest request, HttpsConnectionContext connectionContext)
HttpRequest across the (cached) host connection pool for the request's
effective URI to produce a response future.
The defaultClientHttpsContext is used to configure TLS for the connection.
Note that the request must have either an absolute URI or a valid Host header, otherwise
the future will be completed with an error.
request - (undocumented)connectionContext - (undocumented)public java.util.concurrent.CompletionStage<HttpResponse> singleRequest(HttpRequest request, HttpsConnectionContext connectionContext, ConnectionPoolSettings settings, org.apache.pekko.event.LoggingAdapter log)
HttpRequest across the (cached) host connection pool for the request's
effective URI to produce a response future.
The given HttpsConnectionContext will be used for encryption if the request is sent to an https endpoint.
Note that the request must have either an absolute URI or a valid Host header, otherwise
the future will be completed with an error.
request - (undocumented)connectionContext - (undocumented)settings - (undocumented)log - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<Message,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> webSocketClientLayer(WebSocketRequest request)
pekko.stream.javadsl.BidiFlow.
The layer is not reusable and must only be materialized once.
request - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<Message,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> webSocketClientLayer(WebSocketRequest request, ClientConnectionSettings settings)
pekko.stream.javadsl.BidiFlow using the configured default ClientConnectionSettings,
configured using the pekko.http.client config section.
The layer is not reusable and must only be materialized once.
request - (undocumented)settings - (undocumented)public org.apache.pekko.stream.javadsl.BidiFlow<Message,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> webSocketClientLayer(WebSocketRequest request, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log)
pekko.stream.javadsl.BidiFlow using the configured default ClientConnectionSettings,
configured using the pekko.http.client config section.
The layer is not reusable and must only be materialized once.
request - (undocumented)settings - (undocumented)log - (undocumented)public org.apache.pekko.stream.javadsl.Flow<Message,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> webSocketClientFlow(WebSocketRequest request)
The layer is not reusable and must only be materialized once.
request - (undocumented)public org.apache.pekko.stream.javadsl.Flow<Message,Message,java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>> webSocketClientFlow(WebSocketRequest request, ConnectionContext connectionContext, java.util.Optional<java.net.InetSocketAddress> localAddress, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log)
The layer is not reusable and must only be materialized once.
request - (undocumented)connectionContext - (undocumented)localAddress - (undocumented)settings - (undocumented)log - (undocumented)public <T> org.apache.pekko.japi.Pair<java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>,T> singleWebSocketRequest(WebSocketRequest request, org.apache.pekko.stream.javadsl.Flow<Message,Message,T> clientFlow, org.apache.pekko.stream.Materializer materializer)
The defaultClientHttpsContext is used to configure TLS for the connection.
request - (undocumented)clientFlow - (undocumented)materializer - (undocumented)public <T> org.apache.pekko.japi.Pair<java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>,T> singleWebSocketRequest(WebSocketRequest request, org.apache.pekko.stream.javadsl.Flow<Message,Message,T> clientFlow, ConnectionContext connectionContext, org.apache.pekko.stream.Materializer materializer)
The defaultClientHttpsContext is used to configure TLS for the connection.
request - (undocumented)clientFlow - (undocumented)connectionContext - (undocumented)materializer - (undocumented)public <T> org.apache.pekko.japi.Pair<java.util.concurrent.CompletionStage<WebSocketUpgradeResponse>,T> singleWebSocketRequest(WebSocketRequest request, org.apache.pekko.stream.javadsl.Flow<Message,Message,T> clientFlow, ConnectionContext connectionContext, java.util.Optional<java.net.InetSocketAddress> localAddress, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log, org.apache.pekko.stream.Materializer materializer)
request - (undocumented)clientFlow - (undocumented)connectionContext - (undocumented)localAddress - (undocumented)settings - (undocumented)log - (undocumented)materializer - (undocumented)public java.util.concurrent.CompletionStage<scala.runtime.BoxedUnit> shutdownAllConnectionPools()
pekko.actor.ActorSystem.
The returned future is completed when all pools that were live at the time of this method call
have completed their shutdown process.
If existing pool client flows are re-used or new ones materialized concurrently with or after this method call the respective connection pools will be restarted and not contribute to the returned future.
public ConnectionContext defaultServerHttpContext()
ConnectionContext – defaults to plain HTTP.
Can be modified using setDefaultServerHttpContext, and will then apply for servers bound after that call has completed.
public void setDefaultServerHttpContext(ConnectionContext context)
ConnectionContext.
If it is an instance of HttpsConnectionContext then the server will be bound using HTTPS.
context - (undocumented)public HttpsConnectionContext defaultClientHttpsContext()
ConnectionContext.public void setDefaultClientHttpsContext(HttpsConnectionContext context)
ConnectionContext.context - (undocumented)public HttpsConnectionContext createServerHttpsContext(com.typesafe.sslconfig.pekko.PekkoSSLConfig sslConfig)
public HttpsConnectionContext createClientHttpsContext(com.typesafe.sslconfig.pekko.PekkoSSLConfig sslConfig)
public HttpsConnectionContext createDefaultClientHttpsContext()