All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.factoryfx.jetty.HandlerCollectionFactory Maven / Gradle / Ivy

package io.github.factoryfx.jetty;

import io.github.factoryfx.factory.FactoryBase;
import io.github.factoryfx.factory.SimpleFactoryBase;
import io.github.factoryfx.factory.attribute.dependency.FactoryPolymorphicListAttribute;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;

public class HandlerCollectionFactory> extends SimpleFactoryBase {
    public final FactoryPolymorphicListAttribute handlers = new FactoryPolymorphicListAttribute().labelText("Handlers");

    @Override
    protected ContextHandlerCollection createImpl() {
        return new ContextHandlerCollection(true,handlers.instances().stream().map(ContextHandler::new).toList().toArray(new ContextHandler[0]));
    }

    public HandlerCollectionFactory(){
        this.configLifeCycle().setUpdater(handlerCollection -> handlerCollection.setHandlers(handlers.instances().stream().map(ContextHandler::new).toList().toArray(new ContextHandler[0])));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy