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

de.factoryfx.server.rest.client.RestClientFactory Maven / Gradle / Ivy

The newest version!
package de.factoryfx.server.rest.client;

import de.factoryfx.data.attribute.primitive.BooleanAttribute;
import de.factoryfx.data.attribute.primitive.IntegerAttribute;
import de.factoryfx.data.attribute.types.StringAttribute;
import de.factoryfx.factory.FactoryBase;
import de.factoryfx.factory.SimpleFactoryBase;

public class RestClientFactory> extends SimpleFactoryBase {
    public final BooleanAttribute ssl=new BooleanAttribute().labelText("ssl");
    public final StringAttribute host=new StringAttribute().labelText("host");
    public final IntegerAttribute port=new IntegerAttribute().labelText("port");
    public final StringAttribute path=new StringAttribute().labelText("path").defaultValue("adminui");

    public final StringAttribute httpAuthenticationUser=new StringAttribute().labelText("httpAuthenticationUser").nullable();
    public final StringAttribute httpAuthenticationPassword=new StringAttribute().labelText("httpAuthenticationPassword").nullable();

    @Override
    public RestClient createImpl() {
        return new RestClient(host.get(),port.get(),path.get(),ssl.get(),httpAuthenticationUser.get(),httpAuthenticationPassword.get());
    }

    public RestClientFactory(){
        config().setDisplayTextProvider(() -> (ssl.get() ? "https" : "http") + "://" + host.get() + ":" + port.get() + "/" + path.get() + "/");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy