Class Http

java.lang.Object
akka.http.javadsl.Http
All Implemented Interfaces:
akka.actor.Extension

public class Http extends Object implements akka.actor.Extension
  • Constructor Details

    • Http

      public Http(akka.actor.ExtendedActorSystem system)
  • Method Details

    • get

      public static Http get(akka.actor.ActorSystem system)
    • get

      public static Http get(akka.actor.ClassicActorSystemProvider system)
    • lookup

      public static Http$ lookup()
    • createExtension

      public static Http createExtension(akka.actor.ExtendedActorSystem system)
    • apply

      public static T apply(akka.actor.ActorSystem system)
    • apply

      public static T apply(akka.actor.ClassicActorSystemProvider system)
    • hashCode

      public static final int hashCode()
    • equals

      public static final boolean equals(Object other)
    • serverLayer

      public akka.stream.javadsl.BidiFlow<HttpResponse,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpRequest,akka.NotUsed> serverLayer()
      Constructs a server layer stage using the configured default ServerSettings. The returned BidiFlow isn't reusable and can only be materialized once.
      Returns:
      (undocumented)
    • serverLayer

      public akka.stream.javadsl.BidiFlow<HttpResponse,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpRequest,akka.NotUsed> serverLayer(ServerSettings settings)
      Constructs a server layer stage using the given ServerSettings. The returned BidiFlow isn't reusable and can only be materialized once.
      Parameters:
      settings - (undocumented)
      Returns:
      (undocumented)
    • serverLayer

      public akka.stream.javadsl.BidiFlow<HttpResponse,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpRequest,akka.NotUsed> serverLayer(ServerSettings settings, Optional<InetSocketAddress> remoteAddress)
      Constructs a server layer stage using the given ServerSettings. The returned 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 akka.http.server.remote-address-header configuration option is enabled.
      Parameters:
      settings - (undocumented)
      remoteAddress - (undocumented)
      Returns:
      (undocumented)
    • serverLayer

      public akka.stream.javadsl.BidiFlow<HttpResponse,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpRequest,akka.NotUsed> serverLayer(ServerSettings settings, Optional<InetSocketAddress> remoteAddress, akka.event.LoggingAdapter log)
      Constructs a server layer stage using the given ServerSettings. The returned 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 akka.http.server.remote-address-header configuration option is enabled.
      Parameters:
      settings - (undocumented)
      remoteAddress - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • newServerAt

      public ServerBuilder newServerAt(String interface_, int port)
      Main entry point to create a server binding.

      Parameters:
      interface - The interface to bind to.
      port - The port to bind to or 0 if the port should be automatically assigned.
      interface_ - (undocumented)
      Returns:
      (undocumented)
    • bind

      public akka.stream.javadsl.Source<IncomingConnection,CompletionStage<ServerBinding>> bind(ConnectHttp connect)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).connectionSource() instead
      Creates a 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.

      Parameters:
      connect - (undocumented)
      Returns:
      (undocumented)
    • bind

      public akka.stream.javadsl.Source<IncomingConnection,CompletionStage<ServerBinding>> bind(ConnectHttp connect, ServerSettings settings)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).connectionSource() instead
      Creates a 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.

      Parameters:
      connect - (undocumented)
      settings - (undocumented)
      Returns:
      (undocumented)
    • bind

      public akka.stream.javadsl.Source<IncomingConnection,CompletionStage<ServerBinding>> bind(ConnectHttp connect, ServerSettings settings, akka.event.LoggingAdapter log)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).connectionSource() instead
      Creates a 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.

      Parameters:
      connect - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • bindAndHandle

      public CompletionStage<ServerBinding> bindAndHandle(akka.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handler, ConnectHttp connect, akka.stream.Materializer materializer)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).bindFlow(handler) instead.
      Convenience method which starts a new HTTP server at the given endpoint and uses the given handler Flow for processing all incoming connections.

      The number of concurrently accepted connections can be configured by overriding the akka.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.

      Parameters:
      handler - (undocumented)
      connect - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • bindAndHandle

      public CompletionStage<ServerBinding> bindAndHandle(akka.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handler, ConnectHttp connect, ServerSettings settings, akka.event.LoggingAdapter log, akka.stream.Materializer materializer)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).bindFlow(handler) instead.
      Convenience method which starts a new HTTP server at the given endpoint and uses the given handler Flow for processing all incoming connections.

      The number of concurrently accepted connections can be configured by overriding the akka.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.

      Parameters:
      handler - (undocumented)
      connect - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • bindAndHandleSync

      public CompletionStage<ServerBinding> bindAndHandleSync(akka.japi.Function<HttpRequest,HttpResponse> handler, ConnectHttp connect, akka.stream.Materializer materializer)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).bindSync(handler) instead
      Convenience method which starts a new HTTP server at the given endpoint and uses the given handler function for processing all incoming connections.

      The number of concurrently accepted connections can be configured by overriding the akka.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.

      Parameters:
      handler - (undocumented)
      connect - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • bindAndHandleSync

      public CompletionStage<ServerBinding> bindAndHandleSync(akka.japi.Function<HttpRequest,HttpResponse> handler, ConnectHttp connect, ServerSettings settings, akka.event.LoggingAdapter log, akka.stream.Materializer materializer)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).bindSync(handler) instead
      Convenience method which starts a new HTTP server at the given endpoint and uses the given handler function for processing all incoming connections.

      The number of concurrently accepted connections can be configured by overriding the akka.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.

      Parameters:
      handler - (undocumented)
      connect - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • bindAndHandleAsync

      public CompletionStage<ServerBinding> bindAndHandleAsync(akka.japi.Function<HttpRequest,CompletionStage<HttpResponse>> handler, ConnectHttp connect, akka.stream.Materializer materializer)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).bind(handler) instead
      Convenience method which starts a new HTTP server at the given endpoint and uses the given handler function for processing all incoming connections.

      The number of concurrently accepted connections can be configured by overriding the akka.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.

      Parameters:
      handler - (undocumented)
      connect - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • bindAndHandleAsync

      public CompletionStage<ServerBinding> bindAndHandleAsync(akka.japi.Function<HttpRequest,CompletionStage<HttpResponse>> handler, ConnectHttp connect, ServerSettings settings, int parallelism, akka.event.LoggingAdapter log, akka.stream.Materializer materializer)
      Deprecated.
      since 10.2.0: Use Http.get(system).newServerAt(interface, port).withSettings(settings).logTo(log).bind(handler) instead
      Convenience method which starts a new HTTP server at the given endpoint and uses the given handler function for processing all incoming connections.

      The number of concurrently accepted connections can be configured by overriding the akka.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.

      Parameters:
      handler - (undocumented)
      connect - (undocumented)
      settings - (undocumented)
      parallelism - (undocumented)
      log - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • clientLayer

      public akka.stream.javadsl.BidiFlow<HttpRequest,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpResponse,akka.NotUsed> clientLayer(Host hostHeader)
      Constructs a client layer stage using the configured default ClientConnectionSettings.
      Parameters:
      hostHeader - (undocumented)
      Returns:
      (undocumented)
    • clientLayer

      public akka.stream.javadsl.BidiFlow<HttpRequest,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpResponse,akka.NotUsed> clientLayer(Host hostHeader, ClientConnectionSettings settings)
      Constructs a client layer stage using the given ClientConnectionSettings.
      Parameters:
      hostHeader - (undocumented)
      settings - (undocumented)
      Returns:
      (undocumented)
    • clientLayer

      public akka.stream.javadsl.BidiFlow<HttpRequest,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,HttpResponse,akka.NotUsed> clientLayer(Host hostHeader, ClientConnectionSettings settings, akka.event.LoggingAdapter log)
      Constructs a client layer stage using the given ClientConnectionSettings.
      Parameters:
      hostHeader - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • outgoingConnection

      public akka.stream.javadsl.Flow<HttpRequest,HttpResponse,CompletionStage<OutgoingConnection>> outgoingConnection(String host)
      Creates a 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(java.lang.String) over this method.

      Parameters:
      host - (undocumented)
      Returns:
      (undocumented)
    • outgoingConnection

      public akka.stream.javadsl.Flow<HttpRequest,HttpResponse,CompletionStage<OutgoingConnection>> outgoingConnection(ConnectHttp to)
      Creates a 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(java.lang.String) over this method.

      Parameters:
      to - (undocumented)
      Returns:
      (undocumented)
    • outgoingConnection

      public akka.stream.javadsl.Flow<HttpRequest,HttpResponse,CompletionStage<OutgoingConnection>> outgoingConnection(ConnectHttp to, Optional<InetSocketAddress> localAddress, ClientConnectionSettings settings, akka.event.LoggingAdapter log)
      Creates a 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(java.lang.String) over this method.

      Parameters:
      to - (undocumented)
      localAddress - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • connectionTo

      public OutgoingConnectionBuilder connectionTo(String host)
      Creates a builder which will create a single connection to a host every time the built flow is materialized. There is no pooling and you are yourself responsible for lifecycle management of the connection. For a more convenient Request level API see singleRequest()

      Parameters:
      host - (undocumented)
      Returns:
      A builder to configure more specific setup for the connection and then build a Flow&gt;Request, Response, CompletionStage&gt;OutgoingConnection>>.
    • newHostConnectionPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> newHostConnectionPool(String host, akka.stream.Materializer materializer)
      Starts a new connection pool to the given host and configuration and returns a 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.

      Parameters:
      host - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • newHostConnectionPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> newHostConnectionPool(ConnectHttp to, akka.stream.Materializer materializer)
      Starts a new connection pool to the given host and configuration and returns a 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.

      Parameters:
      to - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • newHostConnectionPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> newHostConnectionPool(ConnectHttp to, ConnectionPoolSettings settings, akka.event.LoggingAdapter log, akka.stream.Materializer materializer)
      Same as <T>newHostConnectionPool(java.lang.String,akka.stream.Materializer) but with HTTPS encryption.

      The given ConnectionContext will be used for encryption on the connection.

      Parameters:
      to - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • cachedHostConnectionPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPool(String host)
      Returns a 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 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.

      Parameters:
      host - (undocumented)
      Returns:
      (undocumented)
    • cachedHostConnectionPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPool(ConnectHttp to)
      Returns a 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 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.

      Parameters:
      to - (undocumented)
      Returns:
      (undocumented)
    • cachedHostConnectionPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPool(ConnectHttp to, ConnectionPoolSettings settings, akka.event.LoggingAdapter log)
      Returns a 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 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 akka.http.host-connection-pool config section or pass in a ConnectionPoolSettings explicitly.

      Parameters:
      to - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • cachedHostConnectionPoolHttps

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPoolHttps(ConnectHttp to, ConnectionPoolSettings settings, akka.event.LoggingAdapter log)
      Same as <T>cachedHostConnectionPool(java.lang.String) 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.

      Parameters:
      to - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • cachedHostConnectionPoolHttps

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,HostConnectionPool> cachedHostConnectionPoolHttps(ConnectHttp to)
      Same as <T>cachedHostConnectionPool(java.lang.String) 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.

      Parameters:
      to - (undocumented)
      Returns:
      (undocumented)
    • superPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,akka.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. Note that incoming requests must have either an absolute URI or a valid 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.

      Returns:
      (undocumented)
    • superPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,akka.NotUsed> superPool(ConnectionPoolSettings settings, HttpsConnectionContext connectionContext, akka.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. Note that incoming requests must have either an absolute URI or a valid 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.

      Parameters:
      settings - (undocumented)
      connectionContext - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • superPool

      public <T> akka.stream.javadsl.Flow<akka.japi.Pair<HttpRequest,T>,akka.japi.Pair<scala.util.Try<HttpResponse>,T>,akka.NotUsed> superPool(ConnectionPoolSettings settings, akka.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. Note that incoming requests must have either an absolute URI or a valid 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.

      Parameters:
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • singleRequest

      public 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.

      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.

      Parameters:
      request - (undocumented)
      Returns:
      (undocumented)
    • singleRequest

      public 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.

      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.

      Parameters:
      request - (undocumented)
      connectionContext - (undocumented)
      Returns:
      (undocumented)
    • singleRequest

      public CompletionStage<HttpResponse> singleRequest(HttpRequest request, HttpsConnectionContext connectionContext, ConnectionPoolSettings settings, akka.event.LoggingAdapter log)
      Fires a single 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.

      Parameters:
      request - (undocumented)
      connectionContext - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • webSocketClientLayer

      public akka.stream.javadsl.BidiFlow<Message,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,Message,CompletionStage<WebSocketUpgradeResponse>> webSocketClientLayer(WebSocketRequest request)
      Constructs a WebSocket BidiFlow.

      The layer is not reusable and must only be materialized once.

      Parameters:
      request - (undocumented)
      Returns:
      (undocumented)
    • webSocketClientLayer

      public akka.stream.javadsl.BidiFlow<Message,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,Message,CompletionStage<WebSocketUpgradeResponse>> webSocketClientLayer(WebSocketRequest request, ClientConnectionSettings settings)
      Constructs a WebSocket BidiFlow using the configured default ClientConnectionSettings, configured using the akka.http.client config section.

      The layer is not reusable and must only be materialized once.

      Parameters:
      request - (undocumented)
      settings - (undocumented)
      Returns:
      (undocumented)
    • webSocketClientLayer

      public akka.stream.javadsl.BidiFlow<Message,akka.stream.TLSProtocol.SslTlsOutbound,akka.stream.TLSProtocol.SslTlsInbound,Message,CompletionStage<WebSocketUpgradeResponse>> webSocketClientLayer(WebSocketRequest request, ClientConnectionSettings settings, akka.event.LoggingAdapter log)
      Constructs a WebSocket BidiFlow using the configured default ClientConnectionSettings, configured using the akka.http.client config section.

      The layer is not reusable and must only be materialized once.

      Parameters:
      request - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • webSocketClientFlow

      public akka.stream.javadsl.Flow<Message,Message,CompletionStage<WebSocketUpgradeResponse>> webSocketClientFlow(WebSocketRequest request)
      Constructs a flow that once materialized establishes a WebSocket connection to the given Uri.

      The layer is not reusable and must only be materialized once.

      Parameters:
      request - (undocumented)
      Returns:
      (undocumented)
    • webSocketClientFlow

      public akka.stream.javadsl.Flow<Message,Message,CompletionStage<WebSocketUpgradeResponse>> webSocketClientFlow(WebSocketRequest request, ConnectionContext connectionContext, Optional<InetSocketAddress> localAddress, ClientConnectionSettings settings, akka.event.LoggingAdapter log)
      Constructs a flow that once materialized establishes a WebSocket connection to the given Uri.

      The layer is not reusable and must only be materialized once.

      Parameters:
      request - (undocumented)
      connectionContext - (undocumented)
      localAddress - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      Returns:
      (undocumented)
    • singleWebSocketRequest

      public <T> akka.japi.Pair<CompletionStage<WebSocketUpgradeResponse>,T> singleWebSocketRequest(WebSocketRequest request, akka.stream.javadsl.Flow<Message,Message,T> clientFlow, akka.stream.Materializer materializer)
      Runs a single WebSocket conversation given a Uri and a flow that represents the client side of the WebSocket conversation.

      The defaultClientHttpsContext() is used to configure TLS for the connection.

      Parameters:
      request - (undocumented)
      clientFlow - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • singleWebSocketRequest

      public <T> akka.japi.Pair<CompletionStage<WebSocketUpgradeResponse>,T> singleWebSocketRequest(WebSocketRequest request, akka.stream.javadsl.Flow<Message,Message,T> clientFlow, ConnectionContext connectionContext, akka.stream.Materializer materializer)
      Runs a single WebSocket conversation given a Uri and a flow that represents the client side of the WebSocket conversation.

      The defaultClientHttpsContext() is used to configure TLS for the connection.

      Parameters:
      request - (undocumented)
      clientFlow - (undocumented)
      connectionContext - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • singleWebSocketRequest

      public <T> akka.japi.Pair<CompletionStage<WebSocketUpgradeResponse>,T> singleWebSocketRequest(WebSocketRequest request, akka.stream.javadsl.Flow<Message,Message,T> clientFlow, ConnectionContext connectionContext, Optional<InetSocketAddress> localAddress, ClientConnectionSettings settings, akka.event.LoggingAdapter log, akka.stream.Materializer materializer)
      Runs a single WebSocket conversation given a Uri and a flow that represents the client side of the WebSocket conversation.
      Parameters:
      request - (undocumented)
      clientFlow - (undocumented)
      connectionContext - (undocumented)
      localAddress - (undocumented)
      settings - (undocumented)
      log - (undocumented)
      materializer - (undocumented)
      Returns:
      (undocumented)
    • shutdownAllConnectionPools

      public CompletionStage<scala.runtime.BoxedUnit> shutdownAllConnectionPools()
      Triggers an orderly shutdown of all host connections pools currently maintained by the 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.

      Returns:
      (undocumented)
    • defaultServerHttpContext

      public ConnectionContext defaultServerHttpContext()
      Deprecated.
      since 10.2.0: set context explicitly when binding
      Gets the current default server-side ConnectionContext – defaults to plain HTTP. Can be modified using setDefaultServerHttpContext(akka.http.javadsl.ConnectionContext), and will then apply for servers bound after that call has completed.

      Returns:
      (undocumented)
    • setDefaultServerHttpContext

      public void setDefaultServerHttpContext(ConnectionContext context)
      Deprecated.
      since 10.2.0: set context explicitly when binding
      Sets the default server-side ConnectionContext. If it is an instance of HttpsConnectionContext then the server will be bound using HTTPS.

      Parameters:
      context - (undocumented)
    • defaultClientHttpsContext

      public HttpsConnectionContext defaultClientHttpsContext()
      Gets the current default client-side ConnectionContext.
      Returns:
      (undocumented)
    • setDefaultClientHttpsContext

      public void setDefaultClientHttpsContext(HttpsConnectionContext context)
      Sets the default client-side ConnectionContext.
      Parameters:
      context - (undocumented)
    • createServerHttpsContext

      public HttpsConnectionContext createServerHttpsContext(com.typesafe.sslconfig.akka.AkkaSSLConfig sslConfig)
      Deprecated.
      use ConnectionContext.httpsServer. Since 10.2.0.
    • createClientHttpsContext

      public HttpsConnectionContext createClientHttpsContext(com.typesafe.sslconfig.akka.AkkaSSLConfig sslConfig)
      Deprecated.
      use ConnectionContext.httpsClient. Since 10.2.0.
    • createDefaultClientHttpsContext

      public HttpsConnectionContext createDefaultClientHttpsContext()
      Deprecated.
      use ConnectionContext.httpsClient. Since 10.2.0.