use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.
the class UndertowFilterCustomizer method customize.
@Override
public void customize() {
if (!undertowFractionInstance.isUnsatisfied()) {
UndertowFraction undertow = undertowFractionInstance.get();
if (undertow.subresources().filterConfiguration() == null) {
undertow.filterConfiguration();
}
undertow.subresources().filterConfiguration().customFilter("wfs-health", customFilter -> {
customFilter.module("org.wildfly.swarm.microprofile.health:runtime");
customFilter.className("org.wildfly.swarm.microprofile.health.runtime.SecureHttpContexts");
});
undertow.subresources().server("default-server").subresources().host("default-host").filterRef("wfs-health", f -> {
f.priority(100);
});
} else {
throw new RuntimeException("The health fraction requires the undertow fraction!");
}
}
use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.
the class OpenApiUndertowFilterCustomizer method customize.
@Override
public void customize() {
if (!undertowFractionInstance.isUnsatisfied()) {
UndertowFraction undertow = undertowFractionInstance.get();
if (undertow.subresources().filterConfiguration() == null) {
undertow.filterConfiguration();
}
undertow.subresources().filterConfiguration().customFilter("wfs-openapi", customFilter -> {
customFilter.module("org.wildfly.swarm.microprofile.openapi:runtime");
customFilter.className("org.wildfly.swarm.microprofile.openapi.runtime.OpenApiHttpHandler");
});
undertow.subresources().server("default-server").subresources().host("default-host").filterRef("wfs-openapi", f -> {
f.priority(100);
});
} else {
throw new RuntimeException("The microprofile-openapi fraction requires the undertow fraction!");
}
}
use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.
the class CertInfoProducerTest method testGenerateWithDefaults.
@Test
@Category(CommunityOnly.class)
public void testGenerateWithDefaults() {
CertInfoProducer producer = new CertInfoProducer();
producer.undertow = new UndertowFraction();
producer.generateSelfCertificate.set(true);
CertInfo certInfo = producer.produceCertInfo();
assertThat(certInfo).isNotNull();
assertThat(certInfo.generateSelfSignedCertificateHost()).isEqualTo("localhost");
}
use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.
the class CertInfoProducerTest method testGenerateWithExplicitHost.
@Test
@Category(CommunityOnly.class)
public void testGenerateWithExplicitHost() {
CertInfoProducer producer = new CertInfoProducer();
producer.undertow = new UndertowFraction();
producer.generateSelfCertificate.set(true);
producer.selfCertificateHost.set("www.mycorp.com");
CertInfo certInfo = producer.produceCertInfo();
assertThat(certInfo).isNotNull();
assertThat(certInfo.generateSelfSignedCertificateHost()).isEqualTo("www.mycorp.com");
}
use of org.wildfly.swarm.undertow.UndertowFraction in project wildfly-swarm by wildfly-swarm.
the class HTTP2CustomizerTest method testHTTP2Enabled.
@Test
public void testHTTP2Enabled() {
HTTP2Customizer customizer = new HTTP2Customizer();
customizer.undertow = new UndertowFraction().applyDefaults();
Server server = customizer.undertow.subresources().server(UndertowProperties.DEFAULT_SERVER);
AtomicReference<HttpsListener> listener = new AtomicReference<>();
server.httpsListener("default-https", (config) -> {
listener.set(config);
});
assertThat(listener.get()).isNotNull();
assertThat(listener.get().enableHttp2()).isNull();
customizer.customize();
assertThat(listener.get().enableHttp2()).isTrue();
}
Aggregations