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

restx.HttpSettingsConfig Maven / Gradle / Ivy

There is a newer version: 1.2.0-rc2
Show newest version
package restx;

import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import restx.common.RestxConfig;
import restx.factory.Component;

import java.util.Collection;

/**
 */
@Component(priority = 1000)
public class HttpSettingsConfig implements HttpSettings {
    private final RestxConfig config;

    public HttpSettingsConfig(RestxConfig config) {
        this.config = config;
    }

    @Override
    public Collection forwardedSupport() {
        return Splitter.on(",").trimResults().splitToList(
                config.getString("restx.http.XForwardedSupport").or("127.0.0.1"));
    }

    @Override
    public Optional host() {
        return config.getString("restx.http.host");
    }

    @Override
    public Optional scheme() {
        return config.getString("restx.http.scheme");
    }

    @Override
    public Collection gzipPaths() {
        return Splitter.on(",").trimResults().splitToList(
                config.getString("restx.http.gzip.paths").or("/{s:.+}"));
    }

    @Override
    public boolean decodeURLPathParams() {
        return config.getBoolean("restx.http.decode.url.path.params").or(Boolean.TRUE).booleanValue();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy