Class HttpClient

java.lang.Object
com.xxl.tool.http.client.HttpClient

public class HttpClient extends Object
http client
  • Constructor Details

    • HttpClient

      public HttpClient()
  • Method Details

    • url

      public HttpClient url(String url)
      设置URL
    • header

      public HttpClient header(Map<String,String> header)
      设置请求头,覆盖更新
    • header

      public HttpClient header(String key, String value)
      设置请求头
    • cookie

      public HttpClient cookie(Map<String,String> cookie)
      设置Cookie,覆盖更新
    • cookie

      public HttpClient cookie(String key, String value)
      设置Cookie
    • timeout

      public HttpClient timeout(int timeout)
      超时时间
    • auth

      public HttpClient auth(String auth)
      设置鉴权信息
    • proxy

      public <T> T proxy(Class<T> serviceInterface)
      http client proxy
      Type Parameters:
      T - the service interface type
      Parameters:
      serviceInterface - the service interface
      Returns:
      the proxy instance
    • parseServicePath

      public static String parseServicePath(HttpClientService httpRpcService, Class<?> serviceInterface)
      parse servicePath: service-annotation
      Parameters:
      httpRpcService - service-annotation
      serviceInterface - service-class
      Returns:
      servicePathFinal
    • parseMethodPath

      public static String parseMethodPath(HttpClientMethod httpRpcMethod, Method method)
      parse methodPath: method-annotation > method-name
      Parameters:
      httpRpcMethod - method-annotation
      method - method
      Returns:
      methodPath