类 AbstractBceClient
- java.lang.Object
-
- com.baidubce.AbstractBceClient
-
- 直接已知子类:
AbstractIotHiskBceClient,AbstractRuleEngineBceClient,AbstractTableStorageBceClient,AbstractTsdbBceClient,AclClient,AdaptorClient,AppBlbClient,AsGroupClient,BacnetClient,BaseBceClient,BaseDuMapClient,BaseLpsClient,BaseRosClient,BatchClient,BbcClient,BccClient,BcdClient,BciClient,BcmClient,BecClient,BesClient,BillingClient,BinaryParserClient,BlbClient,BmrClient,BosClient,BvwClient,CdnClient,CertClient,CfcClient,CnapClient,CvcaClient,DccClient,DocClient,DuGoClient,EipBpClient,EipClient,EipGroupClient,EipTpClient,EndpointClient,EniClient,EsgClient,EvsClient,IotAlarmClient,IoTCoreClient,IotDmClient,IotDmV2Client,IotDmV3Client,IotHubClient,IotShcClient,IotSmsReceiverClient,IotTimerClient,IotVizClient,Ipv6GatewayClient,KafkaClient,KmsClient,LssClient,MediaClient,MmsClient,ModbusClient,MolaDbClient,MvsClient,NatClient,OcrClient,PeerConnClient,PlatformClient,RdsClient,RouteClient,RuleDictClient,RuleEngineClient,ScsClient,SesClientSupport,SmsClientSupport,StsClient,SubnetClient,TagClient,VcaClient,VcrClient,VmsClient,VodClient,VodproClient,VpcClient,VpnClient
@ThreadSafe public abstract class AbstractBceClient extends Object
Abstract base class for BCE service clients.Responsible for basic client capabilities that are the same across all BCE SDK Java clients (ex: setting the client endpoint).
Subclass names should be in the form of "com.baidubce.services.xxx.XxxClient", while "xxx" is the service ID and "Xxx" is the capitalized service ID.
-
-
字段概要
字段 修饰符和类型 字段 说明 protected BceClientConfigurationconfigThe client configuration for this client.static StringDEFAULT_CONTENT_TYPEThe default http request content type for all BCE service APIs.static StringDEFAULT_ENCODINGThe default string encoding for all BCE service APIs.static StringDEFAULT_SERVICE_DOMAINThe default service domain for BCE.static StringURL_PREFIXThe common URL prefix for all BCE service APIs.
-
构造器概要
构造器 构造器 说明 AbstractBceClient(BceClientConfiguration config, HttpResponseHandler[] responseHandlers)Equivalent to AbstractBceClient(config, responseHandlers, false)AbstractBceClient(BceClientConfiguration config, HttpResponseHandler[] responseHandlers, boolean isHttpAsyncPutEnabled)Constructs a new AbstractBceClient with the specified client configuration and handlers.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidcomputeBktVirEndpoint(String bucketName)BOS Returns the bucket virtual hosting service endpoint.StringcomputeServiceId()Returns the service ID based on the actual class name.URIgetBktVirEndpoint(String bucketName)Returns the service endpoint(bucket virtual hosting) to which this client will send requests.BceHttpClientgetClient()URIgetEndpoint()Returns the service endpoint to which this client will send requests.StringgetServiceId()Returns the target service ID.protected <T extends AbstractBceResponse>
TinvokeHttpClient(InternalRequest request, Class<T> responseClass)Subclasses should invoke this method for sending request to the target service.booleanisRegionSupported()Returns true if the target service supports regions.voidsetClient(BceHttpClient client)voidshutdown()Shuts down the client and releases all underlying resources.
-
-
-
字段详细资料
-
DEFAULT_SERVICE_DOMAIN
public static final String DEFAULT_SERVICE_DOMAIN
The default service domain for BCE.- 另请参阅:
- 常量字段值
-
URL_PREFIX
public static final String URL_PREFIX
The common URL prefix for all BCE service APIs.- 另请参阅:
- 常量字段值
-
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
The default string encoding for all BCE service APIs.- 另请参阅:
- 常量字段值
-
DEFAULT_CONTENT_TYPE
public static final String DEFAULT_CONTENT_TYPE
The default http request content type for all BCE service APIs.- 另请参阅:
- 常量字段值
-
config
protected BceClientConfiguration config
The client configuration for this client.
-
-
构造器详细资料
-
AbstractBceClient
public AbstractBceClient(BceClientConfiguration config, HttpResponseHandler[] responseHandlers, boolean isHttpAsyncPutEnabled)
Constructs a new AbstractBceClient with the specified client configuration and handlers.The constructor will extract serviceId from the class name automatically. And if there is no endpoint specified in the client configuration, the constructor will create a default one.
- 参数:
config- the client configuration. The constructor makes a copy of this parameter so that it is safe to change the configuration after then.responseHandlers- a list of handlers for processing HTTP responses from services. SeeBceHttpClient.execute(InternalRequest, Class, HttpResponseHandler[])isHttpAsyncPutEnabled- whether or not PUT method use Async manner.- 抛出:
IllegalStateException- if the class name does not follow the naming convention for BCE clients.IllegalArgumentException- if the endpoint specified in the client configuration is not a valid URI.
-
AbstractBceClient
public AbstractBceClient(BceClientConfiguration config, HttpResponseHandler[] responseHandlers)
Equivalent to AbstractBceClient(config, responseHandlers, false)- 参数:
config- the client configuration. The constructor makes a copy of this parameter so that it is safe to change the configuration after then.responseHandlers- a list of handlers for processing HTTP responses from services. SeeBceHttpClient.execute(InternalRequest, Class, HttpResponseHandler[])- 抛出:
IllegalStateException- if the class name does not follow the naming convention for BCE clients.IllegalArgumentException- if the endpoint specified in the client configuration is not a valid URI.
-
-
方法详细资料
-
isRegionSupported
public boolean isRegionSupported()
Returns true if the target service supports regions.The result will impact the construction of default service endpoint.
- 返回:
- true if the target service supports regions.
-
getEndpoint
public URI getEndpoint()
Returns the service endpoint to which this client will send requests.- 返回:
- the service endpoint to which this client will send requests.
-
getServiceId
public String getServiceId()
Returns the target service ID.- 返回:
- the target service ID.
-
getClient
public BceHttpClient getClient()
-
setClient
public void setClient(BceHttpClient client)
-
shutdown
public void shutdown()
Shuts down the client and releases all underlying resources.Invoking this method is NOT a must. Once it is called, no subsequent requests should be made.
-
invokeHttpClient
protected <T extends AbstractBceResponse> T invokeHttpClient(InternalRequest request, Class<T> responseClass)
Subclasses should invoke this method for sending request to the target service.This method will add "Content-Type" and "Date" to headers with default values if not present.
- 类型参数:
T- the type of response- 参数:
request- the request to build up the HTTP request.responseClass- the response class.- 返回:
- the final response object.
-
computeServiceId
public String computeServiceId()
Returns the service ID based on the actual class name.The class name should be in the form of "com.baidubce.services.xxx.XxxClient", while "xxx" is the service ID and "Xxx" is the capitalized service ID.
- 返回:
- the computed service ID.
- 抛出:
IllegalStateException- if the class name does not follow the naming convention for BCE clients.
-
getBktVirEndpoint
public URI getBktVirEndpoint(String bucketName)
Returns the service endpoint(bucket virtual hosting) to which this client will send requests.- 返回:
- the service endpoint(bucket virtual hosting) to which this client will send requests.
-
computeBktVirEndpoint
public void computeBktVirEndpoint(String bucketName)
BOS Returns the bucket virtual hosting service endpoint.The endpoint will be in the form of "http(s)://
[. ].bcebos.com". - 抛出:
IllegalArgumentException- if the endpoint specified in the client configuration is not a valid URI.
-
-