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

org.jboss.resteasy.reactive.server.spi.DefaultRuntimeConfiguration Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package org.jboss.resteasy.reactive.server.spi;

import java.nio.charset.Charset;
import java.time.Duration;
import java.util.List;
import java.util.Optional;

public class DefaultRuntimeConfiguration implements RuntimeConfiguration {
    final Duration readTimeout;
    private final Body body;
    private final Limits limits;

    public DefaultRuntimeConfiguration(Duration readTimeout, boolean deleteUploadedFilesOnEnd, String uploadsDirectory,
            List fileContentTypes, Charset defaultCharset, Optional maxBodySize, long maxFormAttributeSize,
            int maxParameters) {
        this.readTimeout = readTimeout;
        body = new Body() {
            Body.MultiPart multiPart = new Body.MultiPart() {
                @Override
                public List fileContentTypes() {
                    return fileContentTypes;
                }
            };

            @Override
            public boolean deleteUploadedFilesOnEnd() {
                return deleteUploadedFilesOnEnd;
            }

            @Override
            public String uploadsDirectory() {
                return uploadsDirectory;
            }

            @Override
            public Charset defaultCharset() {
                return defaultCharset;
            }

            @Override
            public MultiPart multiPart() {
                return multiPart;
            }
        };
        limits = new Limits() {
            @Override
            public Optional maxBodySize() {
                return maxBodySize;
            }

            @Override
            public long maxFormAttributeSize() {
                return maxFormAttributeSize;
            }

            @Override
            public int maxParameters() {
                return maxParameters;
            }
        };
    }

    @Override
    public Duration readTimeout() {
        return readTimeout;
    }

    @Override
    public Body body() {
        return body;
    }

    @Override
    public Limits limits() {
        return limits;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy