Source:
void configureAdditionalDependencies(OperationContext context, CapabilityServiceBuilder serviceBuilder, ModelNode model, ListenerService service) throws OperationFailedException { ServiceName httpListenerRegistry = context.getCapabilityServiceName(Capabilities.REF_HTTP_LISTENER_REGISTRY, ListenerRegistry.class); serviceBuilder.addDependency(httpListenerRegistry, ListenerRegistry.class, ((HttpListenerService) service).getHttpListenerRegistry()); ModelNode sslContextModel = HttpsListenerResourceDefinition.SSL_CONTEXT.resolveModelAttribute(context, model); ModelNode securityRealmModel = HttpsListenerResourceDefinition.SECURITY_REALM.resolveModelAttribute(context, model); final String sslContextRef = sslContextModel.isDefined() ? sslContextModel.asString() : null; final String securityRealmRef = securityRealmModel.isDefined() ? securityRealmModel.asString() : null; final InjectedValue<SSLContext> sslContextInjector = new InjectedValue<>(); final InjectedValue<SecurityRealm> securityRealmInjector = new InjectedValue<>(); if (securityRealmRef != null) { SecurityRealm.ServiceUtil.addDependency(serviceBuilder, securityRealmInjector, securityRealmRef); } if (sslContextRef != null) { serviceBuilder.addCapabilityRequirement(REF_SSL_CONTEXT, SSLContext.class, sslContextInjector, sslContextRef); } ((HttpsListenerService)service).setSSLContextSupplier(()-> { if (sslContextRef != null) { return sslContextInjector.getValue(); } if (securityRealmRef != null) { SSLContext sslContext = securityRealmInjector.getValue().getSSLContext(); if (sslContext == null) { throw UndertowLogger.ROOT_LOGGER.noSslContextInSecurityRealm(securityRealmRef); } return sslContext; } try { return SSLContext.getDefault(); } catch (Exception e) { throw new IllegalStateException(e); } }); }

Target:
void configureAdditionalDependencies(OperationContext context, CapabilityServiceBuilder serviceBuilder, ModelNode model, ListenerService service) throws OperationFailedException { serviceBuilder.addCapabilityRequirement(Capabilities.REF_HTTP_LISTENER_REGISTRY, ListenerRegistry.class, ((HttpListenerService) service).getHttpListenerRegistry()); ModelNode sslContextModel = HttpsListenerResourceDefinition.SSL_CONTEXT.resolveModelAttribute(context, model); ModelNode securityRealmModel = HttpsListenerResourceDefinition.SECURITY_REALM.resolveModelAttribute(context, model); final String sslContextRef = sslContextModel.isDefined() ? sslContextModel.asString() : null; final String securityRealmRef = securityRealmModel.isDefined() ? securityRealmModel.asString() : null; final InjectedValue<SSLContext> sslContextInjector = new InjectedValue<>(); final InjectedValue<SecurityRealm> securityRealmInjector = new InjectedValue<>(); if (securityRealmRef != null) { SecurityRealm.ServiceUtil.addDependency(serviceBuilder, securityRealmInjector, securityRealmRef); } if (sslContextRef != null) { serviceBuilder.addCapabilityRequirement(REF_SSL_CONTEXT, SSLContext.class, sslContextInjector, sslContextRef); } ((HttpsListenerService)service).setSSLContextSupplier(()-> { if (sslContextRef != null) { return sslContextInjector.getValue(); } if (securityRealmRef != null) { SSLContext sslContext = securityRealmInjector.getValue().getSSLContext(); if (sslContext == null) { throw UndertowLogger.ROOT_LOGGER.noSslContextInSecurityRealm(securityRealmRef); } return sslContext; } try { return SSLContext.getDefault(); } catch (Exception e) { throw new IllegalStateException(e); } }); }