Search in sources :

Example 1 with DefaultCustomizableResponseTypeHandlerRegistry

use of io.micronaut.http.server.netty.types.DefaultCustomizableResponseTypeHandlerRegistry in project micronaut-core by micronaut-projects.

the class DefaultNettyEmbeddedServerFactory method buildInternal.

@NotNull
private NettyEmbeddedServer buildInternal(@NonNull NettyHttpServerConfiguration configuration, boolean isDefaultServer, @Nullable ServerSslConfiguration sslConfiguration) {
    Objects.requireNonNull(configuration, "Netty HTTP server configuration cannot be null");
    List<NettyCustomizableResponseTypeHandler<?>> handlers = Arrays.asList(new FileTypeHandler(configuration.getFileTypeHandlerConfiguration()), new StreamTypeHandler());
    if (isDefaultServer) {
        return new NettyHttpServer(configuration, this, new DefaultCustomizableResponseTypeHandlerRegistry(handlers.toArray(new NettyCustomizableResponseTypeHandler[0])), true);
    } else {
        NettyEmbeddedServices embeddedServices = resolveNettyEmbeddedServices(configuration, sslConfiguration);
        return new NettyHttpServer(configuration, embeddedServices, new DefaultCustomizableResponseTypeHandlerRegistry(handlers.toArray(new NettyCustomizableResponseTypeHandler[0])), false);
    }
}
Also used : DefaultCustomizableResponseTypeHandlerRegistry(io.micronaut.http.server.netty.types.DefaultCustomizableResponseTypeHandlerRegistry) FileTypeHandler(io.micronaut.http.server.netty.types.files.FileTypeHandler) NettyCustomizableResponseTypeHandler(io.micronaut.http.server.netty.types.NettyCustomizableResponseTypeHandler) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DefaultCustomizableResponseTypeHandlerRegistry (io.micronaut.http.server.netty.types.DefaultCustomizableResponseTypeHandlerRegistry)1 NettyCustomizableResponseTypeHandler (io.micronaut.http.server.netty.types.NettyCustomizableResponseTypeHandler)1 FileTypeHandler (io.micronaut.http.server.netty.types.files.FileTypeHandler)1 NotNull (org.jetbrains.annotations.NotNull)1