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

io.femo.http.Environment Maven / Gradle / Ivy

Go to download

An easy to use HTTP API, that supports synchronous and asynchronous execution of HTTP request. On android only asynchronous driver is supported. This library has been backported to jdk 7 to retain compatibility with android!

The newest version!
package io.femo.http;

import io.femo.http.middleware.EnvironmentReplacerMiddleware;
import io.femo.support.jdk7.Supplier;

/**
 * Created by felix on 7/2/16.
 */
public abstract class Environment implements Driver {


    public abstract boolean has(String variable);

    public abstract EnvironmentReplacerMiddleware.HttpSupplier get(String key);

    public abstract Environment set(String name, EnvironmentReplacerMiddleware.HttpSupplier value);

    public Environment set(String name, final String value) {
        return set(name, new EnvironmentReplacerMiddleware.HttpSupplier() {
            @Override
            public String get(HttpRequest req, HttpResponse res) {
                return value;
            }
        });
    }

    public Environment set(String name, final Supplier value) {
        return set(name, new EnvironmentReplacerMiddleware.HttpSupplier() {
            @Override
            public String get(HttpRequest req, HttpResponse res) {
                return value.get();
            }
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy