Search in sources :

Example 1 with NettyHttpServerConfiguration

use of io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration in project micronaut-core by micronaut-projects.

the class DefaultHttpContentProcessorResolver method getServerConfiguration.

private NettyHttpServerConfiguration getServerConfiguration() {
    NettyHttpServerConfiguration nettyHttpServerConfiguration = this.nettyServerConfiguration;
    if (nettyHttpServerConfiguration == null) {
        synchronized (this) {
            // double check
            nettyHttpServerConfiguration = this.nettyServerConfiguration;
            if (nettyHttpServerConfiguration == null) {
                nettyHttpServerConfiguration = serverConfiguration.get();
                this.nettyServerConfiguration = nettyHttpServerConfiguration;
            }
        }
    }
    return nettyHttpServerConfiguration;
}
Also used : NettyHttpServerConfiguration(io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration)

Example 2 with NettyHttpServerConfiguration

use of io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration in project micronaut-core by micronaut-projects.

the class TestNettySecondaryServer method secondaryServer.

@Named("secondary")
@Bean(preDestroy = "stop")
@Requires(property = "NettyMultiServerSpec", value = StringUtils.TRUE)
NettyEmbeddedServer secondaryServer() {
    NettyEmbeddedServer embeddedServer = embeddedServerFactory.build(new NettyHttpServerConfiguration(applicationConfiguration));
    embeddedServer.start();
    return embeddedServer;
}
Also used : NettyHttpServerConfiguration(io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration) Named(jakarta.inject.Named) Requires(io.micronaut.context.annotation.Requires) Bean(io.micronaut.context.annotation.Bean)

Example 3 with NettyHttpServerConfiguration

use of io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration in project micronaut-core by micronaut-projects.

the class SecondaryNettyServer method nettyEmbeddedServer.

@Named(SERVER_ID)
@Context
// <2>
@Bean(preDestroy = "close")
@Requires(beans = Environment.class)
NettyEmbeddedServer nettyEmbeddedServer(NettyEmbeddedServerFactory serverFactory) {
    // <3>
    // configure server programmatically
    final NettyHttpServerConfiguration configuration = // <4>
    new NettyHttpServerConfiguration();
    // <5>
    final ServerSslConfiguration sslConfiguration = new ServerSslConfiguration();
    sslConfiguration.setBuildSelfSigned(true);
    sslConfiguration.setEnabled(true);
    // random port
    sslConfiguration.setPort(-1);
    // <6>
    final NettyEmbeddedServer embeddedServer = serverFactory.build(configuration, sslConfiguration);
    // <7>
    embeddedServer.start();
    // <8>
    return embeddedServer;
}
Also used : NettyHttpServerConfiguration(io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration) ServerSslConfiguration(io.micronaut.http.ssl.ServerSslConfiguration) NettyEmbeddedServer(io.micronaut.http.server.netty.NettyEmbeddedServer) Context(io.micronaut.context.annotation.Context) Named(jakarta.inject.Named) Requires(io.micronaut.context.annotation.Requires) Bean(io.micronaut.context.annotation.Bean)

Aggregations

NettyHttpServerConfiguration (io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration)3 Bean (io.micronaut.context.annotation.Bean)2 Requires (io.micronaut.context.annotation.Requires)2 Named (jakarta.inject.Named)2 Context (io.micronaut.context.annotation.Context)1 NettyEmbeddedServer (io.micronaut.http.server.netty.NettyEmbeddedServer)1 ServerSslConfiguration (io.micronaut.http.ssl.ServerSslConfiguration)1