• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Initialization
  5. Configuring an Instance of ObsClient

Configuring an Instance of ObsClient

You can use the ObsConfiguration configuration class to configure an instance of ObsClient, including the proxy, connection timeout period, maximum number of retry attempts, and other parameters listed in the following table.

Parameter

Description

Method

Recommended Value

connectionTimeout

Timeout period for establishing an HTTP/HTTPS connection, in ms. The default value is 60,000.

ObsConfiguration.setConnectionTimeout

[10000, 60000]

socketTimeout

Timeout duration for transmitting data at the Socket layer, in ms. The default value is 60,000.

ObsConfiguration.setSocketTimeout

[10000, 60000]

maxConnections

Maximum number of concurrently opened HTTP connections. The default value is 1000.

ObsConfiguration.setMaxConnections

Default value

maxErrorRetry

Maximum number of retry attempts (caused by abnormal requests, 500 errors, and 503 errors) The default value is 5.

ObsConfiguration.setMaxErrorRetry

[1, 5]

endPoint

Endpoint for accessing OBS.

ObsConfiguration.setEndPoint

N/A

endpointHttpPort

Port number used in an HTTP request. The default value is 80.

ObsConfiguration.setEndpointHttpPort

N/A

endpointHttpsPort

Port number used in an HTTPS request. The default value is 443.

ObsConfiguration.setEndpointHttpsPort

N/A

httpsOnly

Whether to access OBS over HTTPS. The default value is true.

ObsConfiguration.setHttpsOnly

Default value

httpProxy

HTTP proxy configuration. This parameter is left blank by default.

ObsConfiguration.setHttpProxy

N/A

validateCertificate

Whether to verify the server certificate. The default value is false.

ObsConfiguration.setValidateCertificate

N/A

verifyResponseContentType

Whether to verify ContentType of the response header. The default value is true.

ObsConfiguration.setVerifyResponseContentType

Default value

uploadStreamRetryBufferSize

Size of the cache used for uploading a stream object, in bytes. The default size is 512 KB.

ObsConfiguration.setUploadStreamRetryBufferSize

N/A

readBufferSize

Read cache size used for uploading an object to the socket stream, in bytes. The default value is 8192 bytes.

ObsConfiguration.setReadBufferSize

Default value

writeBufferSize

Write cache size used for uploading an object to the socket stream, in bytes. The default value is 8192 bytes.

ObsConfiguration.setWriteBufferSize

Default value

keyManagerFactory

Factory used for generating javax.net.ssl.KeyManager. This parameter is left blank by default.

ObsConfiguration.setKeyManagerFactory

N/A

trustManagerFactory

Factory used for generating javax.net.ssl.TrustManager. This parameter is left blank by default.

ObsConfiguration.setTrustManagerFactory

N/A

isStrictHostnameVerification

Whether to strictly verify the server-side host name. The default value is false.

ObsConfiguration.setIsStrictHostnameVerification

Default value

NOTE:
  • Parameters whose recommended value is N/A need to be set according to the actual conditions.
  • To improve the upload and download performance of large files in the case that the network bandwidth meets the requirements, you can tune the readBufferSize and writeBufferSize parameters.
  • If the network is unstable, you are advised to set larger values for connectionTimeout and socketTimeout.