Package ru.decipher.provider.http.impl

Source Code of ru.decipher.provider.http.impl.SimpleHttpProviderFactory

package ru.decipher.provider.http.impl;

import ru.decipher.provider.http.HttpProviderWithProxySupportFactory;
import ru.decipher.provider.http.HttpRequest;
import ru.decipher.proxy.impl.HttpProxyConfig;
import ru.decipher.proxy.impl.LocalhostProxyConfig;

/**
* User: Alexander Paderin (apocarteres@gmail.com)
* Date: 10/21/13
* Time: 12:02 PM
*/
public class SimpleHttpProviderFactory<T extends HttpRequest> implements HttpProviderWithProxySupportFactory<T> {

    private static final long PAYLOAD_LENGTH_LIMIT = 1L * 1024 * 1024;

    private final int timeout;
    private final long payloadLimit;

    public SimpleHttpProviderFactory(int timeout) {
        this(timeout, PAYLOAD_LENGTH_LIMIT);
    }

    public SimpleHttpProviderFactory(int timeout, long payloadLimit) {
        this.timeout = timeout;
        this.payloadLimit = payloadLimit;
    }

    @Override
    public SimpleHttpProvider<T> create(HttpProxyConfig proxyConfig) {
        return new SimpleHttpProvider<>(proxyConfig, timeout, payloadLimit);
    }

    @Override
    public SimpleHttpProvider<T> create() {
        return create(new LocalhostProxyConfig());
    }
}
TOP

Related Classes of ru.decipher.provider.http.impl.SimpleHttpProviderFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.