Class HttpConnectOptions

java.lang.Object
io.vertx.core.http.HttpConnectOptions
Direct Known Subclasses:
RequestOptions

public class HttpConnectOptions extends Object
Options describing how an HttpClient will connect to a server.
Author:
Julien Viet
  • Field Details

    • DEFAULT_PROTOCOL_VERSION

      public static final HttpVersion DEFAULT_PROTOCOL_VERSION
      The default value for protocol version = null
    • DEFAULT_PROXY_OPTIONS

      public static final ProxyOptions DEFAULT_PROXY_OPTIONS
      The default value for proxy options = null
    • DEFAULT_SERVER

      public static final SocketAddress DEFAULT_SERVER
      The default value for server method = null
    • DEFAULT_HOST

      public static final String DEFAULT_HOST
      The default value for host name = null
    • DEFAULT_PORT

      public static final Integer DEFAULT_PORT
      The default value for port = null
    • DEFAULT_SSL

      public static final Boolean DEFAULT_SSL
      The default value for SSL = null
    • DEFAULT_CONNECT_TIMEOUT

      public static final long DEFAULT_CONNECT_TIMEOUT
      The default connect timeout = -1L (disabled)
      See Also:
  • Constructor Details

    • HttpConnectOptions

      public HttpConnectOptions()
      Default constructor
    • HttpConnectOptions

      public HttpConnectOptions(HttpConnectOptions other)
      Copy constructor
      Parameters:
      other - the options to copy
    • HttpConnectOptions

      public HttpConnectOptions(JsonObject json)
      Create options from JSON
      Parameters:
      json - the JSON
  • Method Details

    • init

      protected void init()
    • getProtocolVersion

      public HttpVersion getProtocolVersion()
      Returns:
      the connection desired protocol or null to use the default agent configured protocol
    • setProtocolVersion

      public HttpConnectOptions setProtocolVersion(HttpVersion protocolVersion)
      Set the desired HTTP protocol version for this connection.
      Parameters:
      protocolVersion - the desired protocol version
      Returns:
      a reference to this, so the API can be used fluently
    • getProxyOptions

      public ProxyOptions getProxyOptions()
      Get the proxy options override for connections
      Returns:
      proxy options override
    • setProxyOptions

      public HttpConnectOptions setProxyOptions(ProxyOptions proxyOptions)
      Override the HttpClientOptions.setProxyOptions(ProxyOptions) proxy options for connections.
      Parameters:
      proxyOptions - proxy options override object
      Returns:
      a reference to this, so the API can be used fluently
    • getServer

      public Address getServer()
      Get the server address to be used by the client request.
      Returns:
      the server address
    • setServer

      public HttpConnectOptions setServer(Address server)
      Set the server address to be used by the client request.

      When the server address is null, the address will be resolved after the host property by the Vert.x resolver.

      Use this when you want to connect to a specific server address without name resolution.

      Returns:
      a reference to this, so the API can be used fluently
    • getHost

      public String getHost()
      Get the host name to be used by the client request.
      Returns:
      the host name
    • setHost

      public HttpConnectOptions setHost(String host)
      Set the host name to be used by the client request.
      Returns:
      a reference to this, so the API can be used fluently
    • getPort

      public Integer getPort()
      Get the port to be used by the client request.
      Returns:
      the port
    • setPort

      public HttpConnectOptions setPort(Integer port)
      Set the port to be used by the client request.
      Returns:
      a reference to this, so the API can be used fluently
    • isSsl

      public Boolean isSsl()
      Returns:
      is SSL/TLS enabled?
    • setSsl

      public HttpConnectOptions setSsl(Boolean ssl)
      Set whether SSL/TLS is enabled.
      Parameters:
      ssl - true if enabled
      Returns:
      a reference to this, so the API can be used fluently
    • getSslOptions

      public ClientSSLOptions getSslOptions()
      Returns:
      the SSL options
    • setSslOptions

      public HttpConnectOptions setSslOptions(ClientSSLOptions sslOptions)
      Set the SSL options to use.

      When none is provided, the client SSL options will be used instead.

      Parameters:
      sslOptions - the SSL options to use
      Returns:
      a reference to this, so the API can be used fluently
    • getConnectTimeout

      public long getConnectTimeout()
      Returns:
      the amount of time after which, if the request is not obtained from the client within the timeout period, the Future<HttpClientRequest> obtained from the client is failed with a TimeoutException
    • setConnectTimeout

      public HttpConnectOptions setConnectTimeout(long timeout)
      Sets the amount of time after which, if the request is not obtained from the client within the timeout period, the Future<HttpClientRequest> obtained from the client is failed with a TimeoutException. Note this is not related to the TCP HttpClientOptions.setConnectTimeout(int) option, when a request is made against a pooled HTTP client, the timeout applies to the duration to obtain a connection from the pool to serve the request, the timeout might fire because the server does not respond in time or the pool is too busy to serve a request.
      Parameters:
      timeout - the amount of time in milliseconds.
      Returns:
      a reference to this, so the API can be used fluently
    • toJson

      public JsonObject toJson()