本文整理了Java中reactor.netty.http.server.HttpServer.tcpConfiguration()
方法的一些代码示例,展示了HttpServer.tcpConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServer.tcpConfiguration()
方法的具体详情如下:
包路径:reactor.netty.http.server.HttpServer
类名称:HttpServer
方法名:tcpConfiguration
[英]Materialize a TcpServer from the parent HttpServer chain to use with #bind(TcpServer) or separately
[中]从父HttpServer链具体化TcpServer,以便与#bind(TcpServer)一起使用或单独使用
代码示例来源:origin: spring-projects/spring-framework
@Override
protected void initServer() {
this.reactorHandler = createHttpHandlerAdapter();
this.reactorServer = reactor.netty.http.server.HttpServer.create()
.tcpConfiguration(server -> server.host(getHost()))
.port(getPort());
}
代码示例来源:origin: spring-cloud/spring-cloud-gateway
@Override
protected void initServer() {
this.reactorHandler = createHttpHandlerAdapter();
this.reactorServer = reactor.netty.http.server.HttpServer.create()
.tcpConfiguration(server -> server.host(getHost()))
.port(getPort());
}
代码示例来源:origin: org.springframework.boot/spring-boot
private HttpServer createHttpServer() {
HttpServer server = HttpServer.create();
if (this.resourceFactory != null) {
LoopResources resources = this.resourceFactory.getLoopResources();
Assert.notNull(resources,
"No LoopResources: is ReactorResourceFactory not initialized yet?");
server = server.tcpConfiguration((tcpServer) -> tcpServer.runOn(resources)
.addressSupplier(this::getListenAddress));
}
else {
server = server.tcpConfiguration(
(tcpServer) -> tcpServer.addressSupplier(this::getListenAddress));
}
if (getSsl() != null && getSsl().isEnabled()) {
SslServerCustomizer sslServerCustomizer = new SslServerCustomizer(getSsl(),
getHttp2(), getSslStoreProvider());
server = sslServerCustomizer.apply(server);
}
if (getCompression() != null && getCompression().getEnabled()) {
CompressionCustomizer compressionCustomizer = new CompressionCustomizer(
getCompression());
server = compressionCustomizer.apply(server);
}
server = server.protocol(listProtocols()).forwarded(this.useForwardHeaders);
return applyCustomizers(server);
}
代码示例来源:origin: reactor/reactor-netty
@Override
protected TcpServer tcpConfiguration() {
return source.tcpConfiguration();
}
代码示例来源:origin: reactor/reactor-netty
@Override
protected TcpServer tcpConfiguration() {
return Objects.requireNonNull(tcpServerMapper.apply(source.tcpConfiguration()),
"tcpServerMapper");
}
}
代码示例来源:origin: io.projectreactor.netty/reactor-netty
@Override
protected TcpServer tcpConfiguration() {
return Objects.requireNonNull(tcpServerMapper.apply(source.tcpConfiguration()),
"tcpServerMapper");
}
}
代码示例来源:origin: reactor/reactor-netty
/**
* The port to which this server should bind.
*
* @param port The port to bind to.
*
* @return a new {@link HttpServer}
*/
public final HttpServer port(int port) {
return tcpConfiguration(tcpServer -> tcpServer.port(port));
}
代码示例来源:origin: reactor/reactor-netty
/**
* The host to which this server should bind.
*
* @param host The host to bind to.
*
* @return a new {@link HttpServer}
*/
public final HttpServer host(String host) {
return tcpConfiguration(tcpServer -> tcpServer.host(host));
}
代码示例来源:origin: reactor/reactor-netty
@Override
protected TcpServer tcpConfiguration() {
return source.tcpConfiguration().secure(this.sslProvider);
}
}
代码示例来源:origin: reactor/reactor-netty
@Override
protected TcpServer tcpConfiguration() {
return source.tcpConfiguration().bootstrap(this);
}
代码示例来源:origin: io.projectreactor.netty/reactor-netty
/**
* The host to which this server should bind.
*
* @param host The host to bind to.
*
* @return a new {@link HttpServer}
*/
public final HttpServer host(String host) {
return tcpConfiguration(tcpServer -> tcpServer.host(host));
}
代码示例来源:origin: reactor/reactor-netty
/**
* Apply a wire logger configuration using {@link HttpServer} category
* and {@code DEBUG} logger level
*
* @return a new {@link HttpServer}
* @deprecated Use {@link HttpServer#wiretap(boolean)}
*/
@Deprecated
public final HttpServer wiretap() {
return tcpConfiguration(tcpServer ->
tcpServer.bootstrap(b -> BootstrapHandlers.updateLogSupport(b, LOGGING_HANDLER)));
}
代码示例来源:origin: reactor/reactor-netty
/**
* Configure the {@link io.netty.handler.codec.http.HttpServerCodec}'s request decoding options.
*
* @param requestDecoderOptions a function to mutate the provided Http request decoder options
* @return a new {@link HttpServer}
*/
public final HttpServer httpRequestDecoder(Function<HttpRequestDecoderSpec, HttpRequestDecoderSpec> requestDecoderOptions) {
return tcpConfiguration(
requestDecoderOptions.apply(new HttpRequestDecoderSpec())
.build());
}
代码示例来源:origin: io.projectreactor.netty/reactor-netty
/**
* Apply a wire logger configuration using {@link HttpServer} category
* and {@code DEBUG} logger level
*
* @return a new {@link HttpServer}
* @deprecated Use {@link HttpServer#wiretap(boolean)}
*/
@Deprecated
public final HttpServer wiretap() {
return tcpConfiguration(tcpServer ->
tcpServer.bootstrap(b -> BootstrapHandlers.updateLogSupport(b, LOGGING_HANDLER)));
}
代码示例来源:origin: io.projectreactor.netty/reactor-netty
/**
* Configure the {@link io.netty.handler.codec.http.HttpServerCodec}'s request decoding options.
*
* @param requestDecoderOptions a function to mutate the provided Http request decoder options
* @return a new {@link HttpServer}
*/
public final HttpServer httpRequestDecoder(Function<HttpRequestDecoderSpec, HttpRequestDecoderSpec> requestDecoderOptions) {
return tcpConfiguration(
requestDecoderOptions.apply(new HttpRequestDecoderSpec())
.build());
}
代码示例来源:origin: reactor/reactor-netty
/**
* The HTTP protocol to support. Default is {@link HttpProtocol#HTTP11}.
*
* @param supportedProtocols The various {@link HttpProtocol} this server will support
*
* @return a new {@link HttpServer}
*/
public final HttpServer protocol(HttpProtocol... supportedProtocols) {
return tcpConfiguration(tcpServer -> tcpServer.bootstrap(b -> HttpServerConfiguration.protocols(b, supportedProtocols)));
}
代码示例来源:origin: io.projectreactor.netty/reactor-netty
/**
* The HTTP protocol to support. Default is {@link HttpProtocol#HTTP11}.
*
* @param supportedProtocols The various {@link HttpProtocol} this server will support
*
* @return a new {@link HttpServer}
*/
public final HttpServer protocol(HttpProtocol... supportedProtocols) {
return tcpConfiguration(tcpServer -> tcpServer.bootstrap(b -> HttpServerConfiguration.protocols(b, supportedProtocols)));
}
代码示例来源:origin: reactor/reactor-netty
/**
* Configure the
* {@link ServerCookieEncoder} and {@link ServerCookieDecoder}
*
* @param encoder the preferred ServerCookieEncoder
* @param decoder the preferred ServerCookieDecoder
*
* @return a new {@link HttpServer}
*/
public final HttpServer cookieCodec(ServerCookieEncoder encoder, ServerCookieDecoder decoder) {
return tcpConfiguration(tcp -> tcp.bootstrap(
b -> HttpServerConfiguration.cookieCodec(b, encoder, decoder)));
}
代码示例来源:origin: reactor/reactor-netty
@Test
public void gettingOptionsDuplicates() {
HttpServer server = HttpServer.create()
.port(123)
.host(("foo"))
.compress(true);
assertThat(server.tcpConfiguration().configure())
.isNotSameAs(HttpServer.DEFAULT_TCP_SERVER)
.isNotSameAs(server.tcpConfiguration().configure());
}
代码示例来源:origin: reactor/reactor-netty
@Test
public void testRestart() {
doTestRestart(HttpServer.create()
.port(8080),
HttpClient.create()
.port(8080));
doTestRestart(HttpServer.create()
// Any local address
.tcpConfiguration(tcpServer -> tcpServer.addressSupplier(() -> new InetSocketAddress(8080))),
HttpClient.create()
.port(8080));
}
内容来源于网络,如有侵权,请联系作者删除!