}
public static Registry buildBaseRegistry(Stopper stopper, LaunchConfig launchConfig) {
ErrorHandler errorHandler = launchConfig.isDevelopment() ? new DefaultDevelopmentErrorHandler() : new DefaultProductionErrorHandler();
RegistryBuilder registryBuilder = Registries.registry()
.add(Stopper.class, stopper)
.add(MimeTypes.class, new ActivationBackedMimeTypes())
.add(PublicAddress.class, new DefaultPublicAddress(launchConfig.getPublicAddress(), launchConfig.getSSLContext() == null ? HTTP_SCHEME : HTTPS_SCHEME))
.add(Redirector.class, new DefaultRedirector())
.add(ClientErrorHandler.class, errorHandler)
.add(ServerErrorHandler.class, errorHandler)
.add(LaunchConfig.class, launchConfig)
.add(FileRenderer.class, new DefaultFileRenderer())
.add(ServerSentEventsRenderer.TYPE, new ServerSentEventsRenderer(launchConfig.getBufferAllocator()))
.add(HttpResponseChunksRenderer.TYPE, new HttpResponseChunksRenderer())
.add(CharSequenceRenderer.class, new DefaultCharSequenceRenderer())
.add(FormParser.class, FormParser.multiPart())
.add(FormParser.class, FormParser.urlEncoded())
.add(HttpClient.class, HttpClients.httpClient(launchConfig));
if (launchConfig.isHasBaseDir()) {
registryBuilder.add(FileSystemBinding.class, launchConfig.getBaseDir());
}
Registry foundationRegistry = registryBuilder.build();
Registry defaultRegistry = launchConfig.getDefaultRegistry();
return defaultRegistry != null ? foundationRegistry.join(defaultRegistry) : foundationRegistry;
}