public class HttpClient extends Object
This class provides methods for making HTTP requests to the MaxCompute Storage API, including regular requests, stream uploads, and stream downloads. It handles connection pooling, timeouts, and authentication through a signature interceptor.
This is an internal class and is not intended for public use.
| Modifier and Type | Field and Description |
|---|---|
static okhttp3.MediaType |
HTML |
static okhttp3.MediaType |
JSON |
static okhttp3.MediaType |
OCTET_STREAM |
| Constructor and Description |
|---|
HttpClient(StubSettings settings)
Constructs a new HttpClient with the provided settings.
|
| Modifier and Type | Method and Description |
|---|---|
HttpResponse |
request(okhttp3.Request request)
Makes a generic, one-time request (used for metadata operations).
|
HttpResponse |
request(String path,
String method,
Map<String,String> params,
Map<String,String> headers,
String body)
Makes a generic, one-time request (used for metadata operations).
|
HttpResponse |
requestWithoutRetry(okhttp3.Request request)
Makes a generic, one-time request without automatic retry.
|
void |
shutdown() |
HttpResponse |
streamDownload(String path,
String method,
Map<String,String> params,
Map<String,String> headers,
String body)
Stream download request (replaces connect + getInputStream).
|
HttpResponse |
streamUpload(String path,
String method,
Map<String,String> params,
Map<String,String> headers,
okhttp3.RequestBody requestBody)
Uploads data using a stream.
|
public static final okhttp3.MediaType JSON
public static final okhttp3.MediaType HTML
public static final okhttp3.MediaType OCTET_STREAM
public HttpClient(StubSettings settings)
settings - The settings for configuring the HTTP clientpublic HttpResponse request(okhttp3.Request request)
request - The requestMaxStorageException - if the request failspublic HttpResponse requestWithoutRetry(okhttp3.Request request)
This method executes the request exactly once without any retry logic. Use this when you need to handle retry logic yourself or when retry is not desired.
request - The requestMaxStorageException - if the request failspublic HttpResponse request(String path, String method, Map<String,String> params, Map<String,String> headers, String body)
path - The API pathmethod - The HTTP methodparams - The query parametersheaders - The HTTP headersbody - The request bodyMaxStorageException - if the request failspublic HttpResponse streamUpload(String path, String method, Map<String,String> params, Map<String,String> headers, okhttp3.RequestBody requestBody)
Note: This method does not perform automatic retry. Retry logic should be implemented at the StorageStub layer where the business logic and stream reset capability can be managed.
path - The API pathmethod - The HTTP methodparams - The query parametersheaders - The HTTP headersMaxStorageException - if the request failspublic HttpResponse streamDownload(String path, String method, Map<String,String> params, Map<String,String> headers, String body)
path - The API pathmethod - The HTTP methodparams - The query parametersheaders - The HTTP headersbody - The request bodyMaxStorageException - if the request failspublic void shutdown()
Copyright © 2026 Alibaba Cloud Computing. All rights reserved.