类 NativeHttpClient

java.lang.Object
io.github.wooenrico.http.URLConnection.NativeHttpClient
所有已实现的接口:
HttpExecutor
直接已知子类:
ProxyBasicAuthNativeHttpClient

public class NativeHttpClient extends Object implements HttpExecutor
NativeHttpClient
  • 构造器详细资料

    • NativeHttpClient

      public NativeHttpClient(SSLContext sslContext, HostnameVerifier hostnameVerifier, Proxy proxy, int connectTimeout, int readTimeout)
      Constructs a new NativeHttpClient.
      参数:
      sslContext - SSLContext
      hostnameVerifier - HostnameVerifier
      proxy - Proxy
      connectTimeout - connectTimeout in milliseconds
      readTimeout - readTimeout in milliseconds
  • 方法详细资料

    • getSslContext

      public SSLContext getSslContext()
      Returns the SSLContext of the client.
      返回:
      the SSLContext of the client
    • getHostnameVerifier

      public HostnameVerifier getHostnameVerifier()
      Returns the HostnameVerifier of the client.
      返回:
      the HostnameVerifier of the client
    • getProxy

      public Proxy getProxy()
      Returns the Proxy of the client.
      返回:
      the Proxy of the client
    • getConnectTimeout

      public int getConnectTimeout()
      Returns the connectTimeout of the client.
      返回:
      the connectTimeout of the client
    • getReadTimeout

      public int getReadTimeout()
      Returns the readTimeout of the client.
      返回:
      the readTimeout of the client
    • getUrlConnection

      public HttpURLConnection getUrlConnection(URL url) throws IOException
      Returns the HttpURLConnection of the URL.
      参数:
      url - URL
      返回:
      the HttpURLConnection of the URL
      抛出:
      IOException - if an I/O error occurs
    • execute

      public HttpResponse execute(HttpRequest httpRequest) throws IOException
      从接口复制的说明: HttpExecutor
      执行http请求
      指定者:
      execute 在接口中 HttpExecutor
      参数:
      httpRequest - http请求内容
      返回:
      HttpResponse http响应
      抛出:
      IOException
    • execute

      public CompletableFuture<HttpResponse> execute(HttpRequest httpRequest, Executor executor)
      从接口复制的说明: HttpExecutor
      异步执行http请求
      指定者:
      execute 在接口中 HttpExecutor
      参数:
      httpRequest - http请求内容
      executor - 线程池
      返回:
      CompletableFuture of HttpResponse http响应