use of io.micronaut.http.server.netty.types.files.FileTypeHandler 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);
}
}
Aggregations