Class Info |
|---|
public abstract static class Request.Builder Builder for the Request object. Use the newRequest method of HttpClient to create a Request.Builder object. |
Qualifier and Type | Method Name and Description |
|---|---|
public abstract Request.Builder | addHeader(String name, String value) Adds a message header. |
public abstract Request | build() Builds a Request object. |
public abstract Request.Builder | method(String method) Sets the request method. |
public abstract Request.Builder | options(String options) Sets the Request object built by Request.Builder. |
public abstract Request.Builder | removeHeader(String name) Removes a message header specified by name from the request. |
public abstract Request.Builder | requestBody(RequestBody requestBody) Sets the request body. |
public abstract Request.Builder | url(String url) Sets the request URL. |
Constructor |
|---|
public Request.Builder() Default constructor for building a Request.Builder object. |
Method |
|---|
public abstract Request.Builder addHeader(String name, String value) Adds a message header. |
Parameters
Name | Description |
|---|---|
name | Message header name. |
value | Message header value. |
Returns
Type | Description |
|---|---|
Request.Builder | Builder for the Request object. |
Method |
|---|
public abstract Request.Builder method(String method) Sets the request method. Several request methods specified for HTTP are supported, such as GET, POST, PUT, and DELETE. |
Parameters
Name | Description |
|---|---|
method | Request method. |
Returns
Type | Description |
|---|---|
Request.Builder | Builder for the Request object. |
Method |
|---|
public abstract Request.Builder options(String options) Sets the Request object built by Request.Builder. |
Parameters
Name | Description |
|---|---|
options | Parameters in JSON format, for example, {"call_timeout":10000,"connect_empty_body":true}. For details about supported parameters, please refer to options. |
options | Description |
|---|---|
call_timeout | Request timeout interval, in milliseconds. The value is of the int type. The default value is 0, indicating that the request never times out. The value must be greater than or equal to 20. |
concurrent_connect_delay | Timeout interval of concurrent connection setup, in milliseconds. The value is of the int type. The default value is 500.
|
connect_empty_body | Indicates whether to set up a connection and transmit data. The value is of the boolean type. The default value is false.
|
connect_timeout | Connection timeout interval, in milliseconds. The value is of the int type. The default value is 10000.
|
enable_concurrent_connect | Indicates whether to enable concurrent connection setup. The value is of the boolean type. The default value is true.
|
ping_interval | Interval at which ping frame detection is performed, in milliseconds. The value is of the int type. The default value is 0, indicating that ping frame detection does not take effect. The value must be greater than 0. |
read_timeout | Read timeout interval, in milliseconds. The value is of the int type. The default value is 10000. The value must be greater than 0. |
retry_time | Number of request retries. A retry will be triggered upon an I/O exception. The value is of the int type. The default value is 1, indicating that one retry is supported upon a failure. The value must be greater than or equal to 0. |
write_timeout | Write timeout interval, in milliseconds. The value is of the int type. The default value is 10000. The value must be greater than 0. |
Returns
Type | Description |
|---|---|
Request.Builder | Builder for the Request object. |
Method |
|---|
public abstract Request.Builder removeHeader(String name) Removes a message header specified by name from the request. |
Parameters
Name | Description |
|---|---|
name | Message header name. |
Returns
Type | Description |
|---|---|
Request.Builder | Builder for the Request object. |
Method |
|---|
public abstract Request.Builder requestBody(RequestBody requestBody) Sets the request body. |
Parameters
Name | Description |
|---|---|
requestBody | Request body. |
Returns
Type | Description |
|---|---|
Request.Builder | Builder for the Request object. |
Method |
|---|
public abstract Request.Builder url(String url) Sets the request URL. |
Parameters
Name | Description |
|---|---|
url | Request URL. |
Returns
Type | Description |
|---|---|
Request.Builder | Builder for the Request object. |