io.github.factoryfx.jetty.UpdateableServletFactory Maven / Gradle / Ivy
package io.github.factoryfx.jetty;
import io.github.factoryfx.factory.util.LanguageText;
import io.github.factoryfx.factory.validation.ValidationResult;
import io.github.factoryfx.factory.FactoryBase;
import io.github.factoryfx.factory.attribute.dependency.FactoryListAttribute;
import java.util.HashSet;
public class UpdateableServletFactory> extends FactoryBase {
public final FactoryListAttribute> servletAndPaths = new FactoryListAttribute>().labelText("servletAndPaths");
public UpdateableServletFactory() {
this.configLifeCycle().setCreator(() -> new UpdateableServlet(servletAndPaths.instances()));
this.configLifeCycle().setUpdater(updateableServlet -> {
updateableServlet.update(servletAndPaths.instances());
});
servletAndPaths.validation(list -> {
HashSet paths = new HashSet<>();
for (ServletAndPathFactory path : list) {
if (!paths.add(path.pathSpec.get())){
return new ValidationResult(true,new LanguageText().en("duplicate path"));
}
}
return new ValidationResult(false,new LanguageText());
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy