Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support errorhandle self define #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.39</version>
<version>5.6.39-snapshot</version>
<packaging>jar</packaging>
<name>cos-java-sdk</name>
<description>java sdk for qcloud cos</description>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/qcloud/cos/ClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.qcloud.cos.endpoint.RegionEndpointBuilder;
import com.qcloud.cos.endpoint.SuffixEndpointBuilder;
import com.qcloud.cos.http.HttpProtocol;
import com.qcloud.cos.internal.CosErrorResponseHandler;
import com.qcloud.cos.region.Region;
import com.qcloud.cos.retry.BackoffStrategy;
import com.qcloud.cos.retry.PredefinedBackoffStrategies;
Expand Down Expand Up @@ -86,6 +87,7 @@ public class ClientConfig {
private String userAgent = DEFAULT_USER_AGENT;
private int readLimit = DEFAULT_READ_LIMIT;
private COSSigner cosSigner = new COSSigner();
private CosErrorResponseHandler cosErrorResponseHandler = new CosErrorResponseHandler();

// 不传入region 用于后续调用List Buckets(获取所有的bucket信息)
public ClientConfig() {
Expand Down Expand Up @@ -271,4 +273,12 @@ public COSSigner getCosSigner() {
public void setCosSigner(COSSigner cosSigner) {
this.cosSigner = cosSigner;
}

public CosErrorResponseHandler getCosErrorResponseHandler() {
return cosErrorResponseHandler;
}

public void setCosErrorResponseHandler(CosErrorResponseHandler cosErrorResponseHandler) {
this.cosErrorResponseHandler = cosErrorResponseHandler;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class DefaultCosHttpClient implements CosHttpClient {

public DefaultCosHttpClient(ClientConfig clientConfig) {
super();
this.errorResponseHandler = new CosErrorResponseHandler();
this.errorResponseHandler = clientConfig.getCosErrorResponseHandler();
this.clientConfig = clientConfig;
this.connectionManager = new PoolingHttpClientConnectionManager();
this.maxErrorRetry = clientConfig.getMaxErrorRetry();
Expand Down