Class HttpSettings

java.lang.Object
com.landawn.abacus.http.HttpSettings

public final class HttpSettings extends Object
Since:
1.3
Author:
Haiyang Li
  • Constructor Details

    • HttpSettings

      public HttpSettings()
  • Method Details

    • create

      public static HttpSettings create()
      Returns:
    • getConnectionTimeout

      public int getConnectionTimeout()
      Gets the connection timeout.
      Returns:
    • setConnectionTimeout

      public HttpSettings setConnectionTimeout(int connectionTimeout)
      Note: Only for HttpClient, not for OKHttpClient.
      Parameters:
      connectionTimeout -
      Returns:
    • getReadTimeout

      public int getReadTimeout()
      Gets the read timeout.
      Returns:
    • setReadTimeout

      public HttpSettings setReadTimeout(int readTimeout)
      Note: Only for HttpClient, not for OKHttpClient.
      Parameters:
      readTimeout -
      Returns:
    • getSSLSocketFactory

      public SSLSocketFactory getSSLSocketFactory()
      Gets the SSL socket factory.
      Returns:
    • setSSLSocketFactory

      public HttpSettings setSSLSocketFactory(SSLSocketFactory sslSocketFactory)
      Sets the SSL socket factory.
      Parameters:
      sslSocketFactory -
      Returns:
    • getUseCaches

      public boolean getUseCaches()
      Gets the use caches.
      Returns:
    • setUseCaches

      public HttpSettings setUseCaches(boolean useCaches)
      Note: Only for HttpClient, not for OKHttpClient.
      Parameters:
      useCaches -
      Returns:
    • doInput

      public boolean doInput()
      Returns:
      true, if successful
      See Also:
    • doInput

      public HttpSettings doInput(boolean doInput)
      Note: Only for HttpClient, not for OKHttpClient.
      Parameters:
      doInput -
      Returns:
      See Also:
    • doOutput

      public boolean doOutput()
      Returns:
      true, if successful
      See Also:
    • doOutput

      public HttpSettings doOutput(boolean doOutput)
      Note: Only for HttpClient, not for OKHttpClient.
      Parameters:
      doOutput -
      Returns:
      See Also:
    • isOneWayRequest

      public boolean isOneWayRequest()
      Checks if is one way request.
      Returns:
      true, if is one way request
    • isOneWayRequest

      public HttpSettings isOneWayRequest(boolean isOneWayRequest)
      Checks if is one way request.
      Parameters:
      isOneWayRequest -
      Returns:
    • getContentFormat

      public ContentFormat getContentFormat()
      Gets the content format.
      Returns:
    • setContentFormat

      public HttpSettings setContentFormat(ContentFormat contentFormat)
      Sets the content format.
      Parameters:
      contentFormat -
      Returns:
    • setContentType

      public HttpSettings setContentType(String contentType)
      Parameters:
      contentType -
      Returns:
    • getContentType

      public String getContentType()
      Returns:
    • setContentEncoding

      public HttpSettings setContentEncoding(String contentEncoding)
      Parameters:
      contentEncoding -
      Returns:
    • getContentEncoding

      public String getContentEncoding()
      Returns:
    • basicAuth

      public HttpSettings basicAuth(String user, Object password)
      Parameters:
      user -
      password -
      Returns:
    • header

      public HttpSettings header(String name, Object value)
      Set http header specified by name/value. If this HttpSettings already has any headers with that name, they are all replaced.
      Parameters:
      name -
      value -
      Returns:
    • headers

      public HttpSettings headers(String name1, Object value1, String name2, Object value2)
      Set http headers specified by name1/value1, name2/value2. If this HttpSettings already has any headers with that name, they are all replaced.
      Parameters:
      name1 -
      value1 -
      name2 -
      value2 -
      Returns:
    • headers

      public HttpSettings headers(String name1, Object value1, String name2, Object value2, String name3, Object value3)
      Set http headers specified by name1/value1, name2/value2, name3/value3. If this HttpSettings already has any headers with that name, they are all replaced.
      Parameters:
      name1 -
      value1 -
      name2 -
      value2 -
      name3 -
      value3 -
      Returns:
    • headers

      public HttpSettings headers(Map<String,?> headers)
      Set http headers specified by the key/value entities from Map. If this HttpSettings already has any headers with that name, they are all replaced.
      Parameters:
      headers -
      Returns:
    • headers

      public HttpSettings headers(HttpHeaders headers)
      Removes all headers on this HttpSettings and adds headers.
      Parameters:
      headers -
      Returns:
    • headers

      public HttpHeaders headers()
      Returns:
    • copy

      public HttpSettings copy()
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns: