Interface ServerBuilder
- 
 public interface ServerBuilderBuilder API to create server bindings.Use {@link Http.newServerAt()} to create a builder, use methods to customize settings, and then call one of the bind* methods to bind a server. 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description ServerBuilderadaptSettings(akka.japi.function.Function<ServerSettings,ServerSettings> f)Adapt the current configured settings with a function.java.util.concurrent.CompletionStage<ServerBinding>bind(HandlerProvider handlerProvider)Bind a new HTTP server and use the given handler provider to create an asynchronoushandlerFlowfor processing all incoming connections.java.util.concurrent.CompletionStage<ServerBinding>bind(akka.japi.function.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> f)Bind a new HTTP server and use the given asynchronoushandlerFlowfor processing all incoming connections.java.util.concurrent.CompletionStage<ServerBinding>bindFlow(akka.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handlerFlow)Binds a new HTTP server at the given endpoint and uses the givenhandlerFlowfor processing all incoming connections.java.util.concurrent.CompletionStage<ServerBinding>bindSync(akka.japi.function.Function<HttpRequest,HttpResponse> f)Bind a new HTTP server at the given endpoint and uses the givenhandlerFlowfor processing all incoming connections.akka.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>>connectionSource()Creates aSourceofIncomingConnectioninstances which represents a prospective HTTP server binding on the givenendpoint.ServerBuilderenableHttps(HttpsConnectionContext context)Enable HTTPS for this binding with the given context.ServerBuilderlogTo(akka.event.LoggingAdapter log)Use a custom loggerServerBuilderonInterface(java.lang.String interface_)Change interface to bind toServerBuilderonPort(int port)Change port to bind toServerBuilderwithMaterializer(akka.stream.Materializer materializer)Use customMaterializerfor the bindingServerBuilderwithSettings(ServerSettings settings)Use customServerSettingsfor the binding.
 
- 
- 
- 
Method Detail- 
onInterfaceServerBuilder onInterface(java.lang.String interface_) Change interface to bind to
 - 
onPortServerBuilder onPort(int port) Change port to bind to
 - 
logToServerBuilder logTo(akka.event.LoggingAdapter log) Use a custom logger
 - 
withSettingsServerBuilder withSettings(ServerSettings settings) Use customServerSettingsfor the binding.- Parameters:
- settings- (undocumented)
- Returns:
- (undocumented)
 
 - 
adaptSettingsServerBuilder adaptSettings(akka.japi.function.Function<ServerSettings,ServerSettings> f) Adapt the current configured settings with a function.- Parameters:
- f- (undocumented)
- Returns:
- (undocumented)
 
 - 
enableHttpsServerBuilder enableHttps(HttpsConnectionContext context) Enable HTTPS for this binding with the given context.- Parameters:
- context- (undocumented)
- Returns:
- (undocumented)
 
 - 
withMaterializerServerBuilder withMaterializer(akka.stream.Materializer materializer) Use customMaterializerfor the binding- Parameters:
- materializer- (undocumented)
- Returns:
- (undocumented)
 
 - 
bindjava.util.concurrent.CompletionStage<ServerBinding> bind(akka.japi.function.Function<HttpRequest,java.util.concurrent.CompletionStage<HttpResponse>> f) Bind a new HTTP server and use the given asynchronoushandlerFlowfor processing all incoming connections.The number of concurrently accepted connections can be configured by overriding the akka.http.server.max-connectionssetting. Please see the documentation in the reference.conf for more information about what kind of guarantees to expect.Supports HTTP/2 on the same port if http2 support is enabled. - Parameters:
- f- (undocumented)
- Returns:
- (undocumented)
 
 - 
bindjava.util.concurrent.CompletionStage<ServerBinding> bind(HandlerProvider handlerProvider) Bind a new HTTP server and use the given handler provider to create an asynchronoushandlerFlowfor processing all incoming connections.Most importantly, you can pass a Route to this method because Route implements HandlerProvider. The number of concurrently accepted connections can be configured by overriding the akka.http.server.max-connectionssetting. Please see the documentation in the reference.conf for more information about what kind of guarantees to expect.Supports HTTP/2 on the same port if http2 support is enabled. - Parameters:
- handlerProvider- (undocumented)
- Returns:
- (undocumented)
 
 - 
bindSyncjava.util.concurrent.CompletionStage<ServerBinding> bindSync(akka.japi.function.Function<HttpRequest,HttpResponse> f) Bind a new HTTP server at the given endpoint and uses the givenhandlerFlowfor processing all incoming connections.The number of concurrently accepted connections can be configured by overriding the akka.http.server.max-connectionssetting. Please see the documentation in the reference.conf for more information about what kind of guarantees to expect.Supports HTTP/2 on the same port if http2 support is enabled. - Parameters:
- f- (undocumented)
- Returns:
- (undocumented)
 
 - 
bindFlowjava.util.concurrent.CompletionStage<ServerBinding> bindFlow(akka.stream.javadsl.Flow<HttpRequest,HttpResponse,?> handlerFlow) Binds a new HTTP server at the given endpoint and uses the givenhandlerFlowfor processing all incoming connections.The number of concurrently accepted connections can be configured by overriding the akka.http.server.max-connectionssetting. Please see the documentation in the reference.conf for more information about what kind of guarantees to expect.- Parameters:
- handlerFlow- (undocumented)
- Returns:
- (undocumented)
 
 - 
connectionSourceakka.stream.javadsl.Source<IncomingConnection,java.util.concurrent.CompletionStage<ServerBinding>> connectionSource() Creates aSourceofIncomingConnectioninstances which represents a prospective HTTP server binding on the givenendpoint.Note that each materialization will create a new binding, so * if the configured 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 configured 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.- Returns:
- (undocumented)
 
 
- 
 
-