A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/swagger-api/swagger-codegen/issues/6852 below:

[JAVA] need to expose getters

Description

this issue addresses a deficiency to the earlier enhancement: #1730.
Issue #1730 added the ability to set the OkHttpClient connectionTimeout for the java clients used; however, it didn't add a way to set the OkHttpClient readTimeout and writeTimeout values. By default, OkHttpClient sets all 3 values to a default of 10 seconds. A limit of 10 seconds for reads and writes is a low enough value that many usage scenarios will require the ability to set a larger value for these.

Swagger-codegen version

version 2.2.3 . It is not a regression issue.

Swagger declaration file content or url Command line used for generation

no specific command line needed for this

Steps to reproduce

generate the java client.
attempt to set the readTimeout and writeTimeout for the ApiClient's internal OkHttpClient.
expected: there are setters to do these that resemble the setConnectTimeout method
actual: there are no setters in the ApiClient that expose these 2 timeout settings

Related issues/PRs

#1730

Suggest a fix/enhancement

the generated ApiClient class needs the following getter / setter pairs:

/**
 * Get read timeout (in milliseconds).
 *
 * @return Timeout in milliseconds
 */
public int getReadTimeout() {
    return httpClient.getReadTimeout();
}

/**
 * Sets the read timeout (in milliseconds).
 * A value of 0 means no timeout, otherwise values must be between 1 and
 * 
 * @param readTimeout connection timeout in milliseconds
 * @return Api client
 */
public ApiClient setReadTimeout(int readTimeout) {
    httpClient.setReadTimeout(readTimeout, TimeUnit.MILLISECONDS);
    return this;
}

/**
 * Get write timeout (in milliseconds).
 *
 * @return Timeout in milliseconds
 */
public int getWriteTimeout() {
    return httpClient.getWriteTimeout();
}

/**
 * Sets the write timeout (in milliseconds).
 * A value of 0 means no timeout, otherwise values must be between 1 and
 *
 * @param writeTimeout connection timeout in milliseconds
 * @return Api client
 */
public ApiClient setWriteTimeout(int writeTimeout) {
    httpClient.setWriteTimeout(writeTimeout, TimeUnit.MILLISECONDS);
    return this;
}

benrobot, jsa-nic and pc-cchandragiri


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4