io.github.factoryfx.jetty.GzipHandlerFactory Maven / Gradle / Ivy
package io.github.factoryfx.jetty;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import io.github.factoryfx.factory.FactoryBase;
import io.github.factoryfx.factory.SimpleFactoryBase;
import io.github.factoryfx.factory.attribute.dependency.FactoryPolymorphicAttribute;
import io.github.factoryfx.factory.attribute.primitive.BooleanAttribute;
import io.github.factoryfx.factory.attribute.primitive.IntegerAttribute;
import io.github.factoryfx.factory.attribute.types.StringListAttribute;
public class GzipHandlerFactory> extends SimpleFactoryBase {
public final FactoryPolymorphicAttribute handler = new FactoryPolymorphicAttribute().labelText("Handler");
public final IntegerAttribute minGzipSize = new IntegerAttribute().labelText("minGzipSize");
public final StringListAttribute excludedMethods = new StringListAttribute().labelText("excludedMethods");
public final StringListAttribute excludedMimeTypes = new StringListAttribute().labelText("excludedMimeTypes");
public final StringListAttribute excludedPaths = new StringListAttribute().labelText("excludedPaths");
public final StringListAttribute includedMethods = new StringListAttribute().labelText("includedMethods");
public final StringListAttribute includedMimeTypes = new StringListAttribute().labelText("includedMimeTypes");
public final StringListAttribute includedPaths = new StringListAttribute().labelText("includedPaths");
public final IntegerAttribute inflateBufferSize = new IntegerAttribute().labelText("inflateBufferSize");
public final BooleanAttribute syncFlush = new BooleanAttribute().labelText("syncFlush");
@Override
protected Handler createImpl() {
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setMinGzipSize(minGzipSize.get());
gzipHandler.setExcludedMethods(excludedMethods.get().toArray(new String[0]));
gzipHandler.setExcludedMimeTypes(excludedMimeTypes.get().toArray(new String[0]));
gzipHandler.setExcludedPaths(excludedPaths.get().toArray(new String[0]));
gzipHandler.setIncludedMethods(includedMethods.get().toArray(new String[0]));
gzipHandler.setIncludedMimeTypes(includedMimeTypes.get().toArray(new String[0]));
gzipHandler.setIncludedPaths(includedPaths.get().toArray(new String[0]));
gzipHandler.setInflateBufferSize(inflateBufferSize.get());
gzipHandler.setSyncFlush(syncFlush.get());
gzipHandler.setHandler(handler.instance());
return gzipHandler;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy