com.mathworks.mps.client

## Interface MWHttpClientConfig

- All Known Implementing Classes:
    MWHttpClientDefaultConfig

      public interface MWHttpClientConfig

  Interface defining the configuration of the client-server connection used by `MWHttpClient`. It provides the following configuration parameters:

  Field Name | Description | Default Value
  DEFAULT_IS_COOKIE_ENABLED | Determines if the client sets the HTTP cookie. | true
  DEFAULT_IS_INTERRUPTABLE | Determines if the client can interrupt MATLAB® function execution. | false
  DEFAULT_RESPONSE_SIZE_LIMIT | Maximum size, in bytes, of the response that a client accepts. | 64*1024*1024 (64 MB)
  DEFAULT_NUM_CONNECTIONS_PER_ADDRESS | Maximum number of connections that the client opens to fulfill multiple requests. | -1, specifies that the client can uses as many connections as the system allows.
  DEFAULT_TIMEOUT_MS | Amount of time, in milliseconds, that the client waits for a server response before timing out. | 120000

  Users should extend `MWHttpClientDefaultConfig` to customize the configuration of the client-server connection.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEFAULT_IS_COOKIE_ENABLED`
    `static boolean` | `DEFAULT_IS_INTERRUPTABLE`
    `static int` | `DEFAULT_NUM_CONNECTIONS_PER_ADDRESS`
    `static boolean` | `DEFAULT_POLL_ON_UPDATE_ERROR_ASYNC`
    `static int` | `DEFAULT_RESPONSE_SIZE_LIMIT`
    `static long` | `DEFAULT_TIMEOUT_MS`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getMaxConnectionsPerAddress()` Get maximum number of connections per address used by `MWHttpClient` to fulfill multiple simultaneous requests created by client.
    `int` | `getResponseSizeLimit()` Get the maximum response size the client can accept.
    `long` | `getTimeOutMs()` Get the time out in milliseconds for a client to receive response from the server.
    `boolean` | `isCookieEnabled()` Use this API to enable handling of cookies in the client application.
    `boolean` | `isInterruptible()` Tells whether this instance of `MWHttpClientConfig` can be used for an interruptible `MWHttpClient`
    `boolean` | `pollOnUpdateErrorAsync()` The return value of this method decides the behavior of the client when there is a loss of network connectivity between the server and the client.

- - ### Field Detail

    - #### DEFAULT_NUM_CONNECTIONS_PER_ADDRESS

          static final int DEFAULT_NUM_CONNECTIONS_PER_ADDRESS

      See Also:
        Constant Field Values

    - #### DEFAULT_TIMEOUT_MS

          static final long DEFAULT_TIMEOUT_MS

      See Also:
        Constant Field Values

    - #### DEFAULT_IS_INTERRUPTABLE

          static final boolean DEFAULT_IS_INTERRUPTABLE

      See Also:
        Constant Field Values

    - #### DEFAULT_RESPONSE_SIZE_LIMIT

          static final int DEFAULT_RESPONSE_SIZE_LIMIT

      See Also:
        Constant Field Values

    - #### DEFAULT_IS_COOKIE_ENABLED

          static final boolean DEFAULT_IS_COOKIE_ENABLED

      See Also:
        Constant Field Values

    - #### DEFAULT_POLL_ON_UPDATE_ERROR_ASYNC

          static final boolean DEFAULT_POLL_ON_UPDATE_ERROR_ASYNC

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getMaxConnectionsPerAddress

          int getMaxConnectionsPerAddress()

      Get maximum number of connections per address used by `MWHttpClient` to fulfill multiple simultaneous requests created by client. If this configuration is meant for non-interruptible instance of `MWHttpClient`, user defined implementations of this method must return -1.
      Returns:
        Maximum number of connections per address

    - #### getTimeOutMs

          long getTimeOutMs()

      Get the time out in milliseconds for a client to receive response from the server.
      Returns:
        Timeout in milliseconds

    - #### isInterruptible

          boolean isInterruptible()

      Tells whether this instance of `MWHttpClientConfig` can be used for an interruptible `MWHttpClient`
      Returns:
        true if this instance of `MWHttpClientConfig` can be used for an interruptible `MWHttpClient` else returns false

    - #### getResponseSizeLimit

          int getResponseSizeLimit()

      Get the maximum response size the client can accept.
      Returns:
        Maximum response size limit in bytes

    - #### isCookieEnabled

          boolean isCookieEnabled()

      Use this API to enable handling of cookies in the client application. A use case for this is when the async API is used to communicate with MATLAB Production Server instances hosted behind a load balancer and when the load balancer is configured to use cookies for session stickiness.
      Returns:
        Returns true if the client wants to enable the HTTP cookie; else, returns false.

    - #### pollOnUpdateErrorAsync

          boolean pollOnUpdateErrorAsync()

      The return value of this method decides the behavior of the client when there is a loss of network connectivity between the server and the client. This method is effective only while using the async interface of the Java client to communicate with MATLAB Production Server instances. Sync requests ignore the value that this method returns. If this method returns true, the Java client will keep polling for state updates for pending async requests when network connectivity is lost. If this method returns false, pending async requests move to a failed state when network connectivity is lost.
      Returns:
        Return true to keep polling for async request updates when network connectivity is lost. Otherwise, return false.

Copyright 2010-2022 The MathWorks, Inc.