com.mathworks.mps.client

## Class MWHttpClientDefaultConfig

- java.lang.Object
- - com.mathworks.mps.client.MWHttpClientDefaultConfig

- All Implemented Interfaces:
    MWHttpClientConfig

      public class MWHttpClientDefaultConfig
      extends java.lang.Object
      implements MWHttpClientConfig

  Default configuration used for creating an instance of `MWHttpClient`. The default configuration consists of the following fields:

  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

  For creating a custom configuration, override the methods of this class.

- - ### Field Summary

    - ### Fields inherited from interface com.mathworks.mps.client.MWHttpClientConfig

      `DEFAULT_IS_COOKIE_ENABLED, DEFAULT_IS_INTERRUPTABLE, DEFAULT_NUM_CONNECTIONS_PER_ADDRESS, DEFAULT_POLL_ON_UPDATE_ERROR_ASYNC, DEFAULT_RESPONSE_SIZE_LIMIT, DEFAULT_TIMEOUT_MS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MWHttpClientDefaultConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getMaxConnectionsPerAddress()` Returns the default value for maximum connections per address
    `int` | `getResponseSizeLimit()` Returns the deafault maximum response size limit in bytes
    `long` | `getTimeOutMs()` Returns the default amount of time, in milliseconds, the client will wait for a response
    `boolean` | `isCookieEnabled()` Use this API to enable handling of cookies in the client application.
    `boolean` | `isInterruptible()` Returns the default interruptible value
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MWHttpClientDefaultConfig

          public MWHttpClientDefaultConfig()

  - ### Method Detail

    - #### getMaxConnectionsPerAddress

          public int getMaxConnectionsPerAddress()

      Returns the default value for maximum connections per address
      Specified by:
        `getMaxConnectionsPerAddress` in interface `MWHttpClientConfig`
      Returns:
        -1 to allow unlimited connections

    - #### getTimeOutMs

          public long getTimeOutMs()

      Returns the default amount of time, in milliseconds, the client will wait for a response
      Specified by:
        `getTimeOutMs` in interface `MWHttpClientConfig`
      Returns:
        120000ms

    - #### isInterruptible

          public boolean isInterruptible()

      Returns the default interruptible value
      Specified by:
        `isInterruptible` in interface `MWHttpClientConfig`
      Returns:
        false

    - #### getResponseSizeLimit

          public int getResponseSizeLimit()

      Returns the deafault maximum response size limit in bytes
      Specified by:
        `getResponseSizeLimit` in interface `MWHttpClientConfig`
      Returns:
        64*1024*1024bytes

    - #### isCookieEnabled

          public 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.
      Specified by:
        `isCookieEnabled` in interface `MWHttpClientConfig`
      Returns:
        Returns true if the client wants to enable the HTTP cookie; else, returns false.

    - #### pollOnUpdateErrorAsync

          public 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.
      Specified by:
        `pollOnUpdateErrorAsync` in interface `MWHttpClientConfig`
      Returns:
        false to avoid polling for async request updates when network connectivity is lost.

Copyright 2010-2022 The MathWorks, Inc.