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

org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClientEngine Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha4
Show newest version
package org.jboss.resteasy.client.jaxrs.engines;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.CloseableHttpClient;
import org.jboss.resteasy.client.jaxrs.ClientHttpEngine;
import org.jboss.resteasy.spi.config.SizeUnit;

public interface ApacheHttpClientEngine extends ClientHttpEngine {
    /**
     * Enumeration to represent memory units.
     *
     * @deprecated use {@link SizeUnit} or {@link org.jboss.resteasy.spi.config.Threshold}
     */
    @Deprecated
    enum MemoryUnit {
        /**
         * Bytes
         */
        BY,
        /**
         * Killo Bytes
         */
        KB,

        /**
         * Mega Bytes
         */
        MB,

        /**
         * Giga Bytes
         */
        GB;

        SizeUnit toSizeUnit() {
            switch (this) {
                case BY:
                    return SizeUnit.BYTE;
                case KB:
                    return SizeUnit.KILOBYTE;
                case MB:
                    return SizeUnit.MEGABYTE;
                case GB:
                    return SizeUnit.GIGABYTE;
            }
            return SizeUnit.BYTE;
        }

        static MemoryUnit of(final SizeUnit unit) {
            switch (unit) {
                case KILOBYTE:
                    return KB;
                case MEGABYTE:
                    return MB;
                case GIGABYTE:
                    return GB;
                default:
                    return BY;
            }
        }
    }

    static ApacheHttpClientEngine create() {
        return new ApacheHttpClient43Engine();
    }

    static ApacheHttpClientEngine create(CloseableHttpClient httpClient) {
        return new ApacheHttpClient43Engine(httpClient);
    }

    static ApacheHttpClientEngine create(HttpClient httpClient, boolean closeHttpClient) {
        return new ApacheHttpClient43Engine(httpClient, closeHttpClient);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy