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

io.github.factoryfx.jetty.ServletContextHandlerFactory 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.FactoryAttribute;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

public class ServletContextHandlerFactory> extends SimpleFactoryBase {

    public final FactoryAttribute> updatableRootServlet = new FactoryAttribute>().labelText("updatableRootServlet");

    @Override
    public Handler createImpl() {
        ServletHolder holder = new ServletHolder(updatableRootServlet.instance());
        ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
        contextHandler.addServlet( holder, "/*");
        ErrorHandler errorHandler = new ErrorHandler();
        errorHandler.setShowStacks(true);
        contextHandler.setErrorHandler(errorHandler);
        return contextHandler;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy