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

com.fireflysource.net.http.client.HttpClient Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.fireflysource.net.http.client;

import com.fireflysource.common.lifecycle.LifeCycle;
import com.fireflysource.net.http.common.model.HttpURI;
import com.fireflysource.net.websocket.client.WebSocketClientConnectionBuilder;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * @author Pengtao Qiu
 */
public interface HttpClient extends HttpClientRequestBuilderFactory, LifeCycle {

    /**
     * Create a new HTTP client connection.
     *
     * @param httpURI            The HTTP URI.
     * @param supportedProtocols The supported application protocols.
     * @return The new HTTP client connection.
     */
    CompletableFuture createHttpClientConnection(HttpURI httpURI, List supportedProtocols);

    /**
     * Create a new HTTP client connection.
     *
     * @param httpURI The HTTP URI.
     * @return The new HTTP client connection.
     */
    default CompletableFuture createHttpClientConnection(HttpURI httpURI) {
        return createHttpClientConnection(httpURI, Collections.emptyList());
    }

    /**
     * Create a new HTTP client connection.
     *
     * @param uri The HTTP URI.
     * @return The new HTTP client connection.
     */
    default CompletableFuture createHttpClientConnection(String uri) {
        return createHttpClientConnection(new HttpURI(uri));
    }

    /**
     * Create a websocket connection builder.
     *
     * @return The websocket connection builder.
     */
    WebSocketClientConnectionBuilder websocket();

    /**
     * Create a websocket connection builder.
     *
     * @param url The websocket url.
     * @return The websocket connection builder.
     */
    WebSocketClientConnectionBuilder websocket(String url);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy