io.dropwizard.core.sslreload.SslReloadTask Maven / Gradle / Ivy
package io.dropwizard.core.sslreload;
import io.dropwizard.jetty.SslReload;
import io.dropwizard.servlets.tasks.Task;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/** A task that will refresh all ssl factories with up to date certificate information */
public class SslReloadTask extends Task {
private Collection reloader = Collections.emptySet();
protected SslReloadTask() {
super("reload-ssl");
}
@Override
public void execute(Map> parameters, PrintWriter output) throws Exception {
// Iterate through all the reloaders first to ensure valid configuration
for (SslReload sslReload : getReloaders()) {
sslReload.reloadDryRun();
}
// Now we know that configuration is valid, reload for real
for (SslReload sslReload : getReloaders()) {
sslReload.reload();
}
output.write("Reloaded certificate configuration\n");
}
public Collection getReloaders() {
return reloader;
}
public void setReloaders(Collection reloader) {
this.reloader = reloader;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy