public abstract class CosXmlRequest
extends java.lang.Object
COS请求基类
限定符和类型 | 类和说明 |
---|---|
static interface |
CosXmlRequest.OnRequestWeightListener
获取请求重量级的监听接口
|
限定符和类型 | 字段和说明 |
---|---|
protected java.lang.String |
bucket
存储桶
|
protected java.util.Set<java.lang.String> |
noSignHeaders
不强制签名的header集合
|
protected java.util.Set<java.lang.String> |
noSignParams
不强制签名的params集合
|
protected int |
priority |
protected QCloudTaskStateListener |
qCloudTaskStateListener
任务状态监听器
|
protected java.util.Map<java.lang.String,java.lang.String> |
queryParameters
url query集合
|
protected java.lang.String |
region
地域
|
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
requestHeaders
请求http header集合
|
protected java.lang.String |
requestURL
请求URL
|
protected QCloudSignSourceProvider |
signSourceProvider
签名原料提供器
|
构造器和说明 |
---|
CosXmlRequest() |
限定符和类型 | 方法和说明 |
---|---|
protected void |
addHeader(java.lang.String key,
java.lang.String value)
添加请求http header
|
void |
addNoSignHeader(java.lang.String key)
添加不强制签名的header键
|
void |
addNoSignParams(java.lang.String key) |
void |
addQuery(java.lang.String key,
java.lang.String value) |
void |
attachMetrics(HttpTaskMetrics metrics)
设置请求性能参数捕获器
|
void |
checkParameters()
sdk 参数校验
|
java.lang.String |
getBucket()
获取存储桶名
|
HttpTask |
getHttpTask()
获取执行任务
|
java.lang.String |
getKeyTime() |
abstract java.lang.String |
getMethod()
获取HTTP请求方法
RequestMethod |
HttpTaskMetrics |
getMetrics()
获取请求性能参数捕获器
|
java.util.Set<java.lang.String> |
getNoSignHeaders()
获取不强制签名的header集合
|
java.util.Set<java.lang.String> |
getNoSignParams() |
abstract java.lang.String |
getPath(CosXmlServiceConfig config)
获取HTTP URL Path
|
int |
getPriority()
获取请求优先级
|
java.lang.String |
getQueryEncodedString() |
java.util.Map<java.lang.String,java.lang.String> |
getQueryString()
获取url query集合
|
java.lang.String |
getRegion()
获取地域
|
RequestBodySerializer |
getRequestBody()
获取请求体
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getRequestHeaders()
获取请求http header集合
|
java.lang.String |
getRequestHost(CosXmlServiceConfig config)
获取请求host
|
java.lang.String |
getRequestURL()
获取请求URL
|
QCloudSignSourceProvider |
getSignSourceProvider()
获取签名原料提供器
|
STSCredentialScope[] |
getSTSCredentialScope(CosXmlServiceConfig config)
获取STS范围限制信息
|
int |
getWeight()
获取请求的重量级
|
boolean |
headersHasUnsafeNonAscii()
header是否有不安全的非Ascii字符
|
boolean |
isNeedMD5()
针对有请求体的 PUT 和 POST 请求,此头部是必选项。
|
boolean |
isSignInUrl() |
boolean |
isSupportAccelerate()
是否启用全球加速
|
void |
isSupportAccelerate(boolean isSupportAccelerate)
是否启用全球加速
|
void |
setNeedMD5(boolean isNeedMD5)
针对有请求体的 PUT 和 POST 请求,此头部是必选项。
|
void |
setOnRequestWeightListener(CosXmlRequest.OnRequestWeightListener onRequestWeightListener)
设置获取请求重量级的监听接口
|
void |
setQueryEncodedString(java.lang.String queryParameterString)
设置 query 字符串
|
void |
setQueryParameters(java.util.Map<java.lang.String,java.lang.String> queryParameters)
设置url query集合
|
void |
setRegion(java.lang.String region)
设置地域
|
void |
setRequestHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
设置请求http header集合
|
void |
setRequestHeaders(java.lang.String key,
java.lang.String value)
已过时。
|
void |
setRequestHeaders(java.lang.String key,
java.lang.String value,
boolean isUrlEncoder)
添加请求http header
|
void |
setRequestURL(java.lang.String requestURL)
设置请求URL
|
void |
setSign(long signDuration)
已过时。
|
void |
setSign(long startTime,
long endTime)
已过时。
|
void |
setSign(long startTime,
long endTime,
java.util.Set<java.lang.String> parameters,
java.util.Set<java.lang.String> headers)
已过时。
|
void |
setSign(long signDuration,
java.util.Set<java.lang.String> parameters,
java.util.Set<java.lang.String> headers)
已过时。
|
void |
setSign(java.lang.String sign)
设置签名Authorization
|
void |
setSignInUrl(boolean signInUrl) |
void |
setSignKeyTime(int expired)
设置签名有效期,单位为 s
|
void |
setSignParamsAndHeaders(java.util.Set<java.lang.String> parameters,
java.util.Set<java.lang.String> headers)
设置参与签名的参数字段和头部字段
|
void |
setSignSourceProvider(QCloudSignSourceProvider cosXmlSignSourceProvider)
设置签名原料提供器
|
void |
setTask(HttpTask httpTask)
设置执行任务
|
void |
setTaskStateListener(QCloudTaskStateListener qCloudTaskStateListener)
设置任务状态监听器
|
protected RequestBodySerializer |
xmlBuilder()
收拢xml解析
|
protected java.util.Map<java.lang.String,java.lang.String> queryParameters
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> requestHeaders
protected java.util.Set<java.lang.String> noSignHeaders
protected java.util.Set<java.lang.String> noSignParams
protected QCloudSignSourceProvider signSourceProvider
protected int priority
protected java.lang.String bucket
protected java.lang.String requestURL
protected java.lang.String region
protected QCloudTaskStateListener qCloudTaskStateListener
public void setRequestURL(java.lang.String requestURL)
requestURL
- 请求URLpublic java.lang.String getRequestURL()
public abstract java.lang.String getMethod()
RequestMethod
public abstract java.lang.String getPath(CosXmlServiceConfig config)
config
- SDK服务配置public java.lang.String getBucket()
public void setQueryParameters(java.util.Map<java.lang.String,java.lang.String> queryParameters)
queryParameters
- url query集合public void addQuery(java.lang.String key, java.lang.String value)
public void setQueryEncodedString(java.lang.String queryParameterString)
queryParameterString
- public void setRequestHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
headers
- 请求http header集合public void addNoSignHeader(java.lang.String key)
key
- 不强制签名的header键public void addNoSignParams(java.lang.String key)
public java.util.Set<java.lang.String> getNoSignHeaders()
public java.util.Set<java.lang.String> getNoSignParams()
public java.util.Map<java.lang.String,java.lang.String> getQueryString()
public java.lang.String getQueryEncodedString()
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestHeaders()
public RequestBodySerializer getRequestBody() throws CosXmlClientException
CosXmlClientException
- 客户异常protected RequestBodySerializer xmlBuilder() throws org.xmlpull.v1.XmlPullParserException, java.io.IOException, CosXmlClientException
org.xmlpull.v1.XmlPullParserException
java.io.IOException
CosXmlClientException
public void checkParameters() throws CosXmlClientException
CosXmlClientException
- cosXmlClientExceptionpublic boolean isNeedMD5()
public void setNeedMD5(boolean isNeedMD5)
public void setTaskStateListener(QCloudTaskStateListener qCloudTaskStateListener)
qCloudTaskStateListener
- 任务状态监听器public HttpTaskMetrics getMetrics()
public void attachMetrics(HttpTaskMetrics metrics)
metrics
- 请求性能参数捕获器public void setSignInUrl(boolean signInUrl)
public boolean isSignInUrl()
@Deprecated public void setRequestHeaders(java.lang.String key, java.lang.String value) throws CosXmlClientException
public void setRequestHeaders(java.lang.String key, java.lang.String value, boolean isUrlEncoder) throws CosXmlClientException
key
- 键value
- 值isUrlEncoder
- 是否进行URL编码CosXmlClientException
- 客户端异常public java.lang.String getKeyTime()
public void setSignKeyTime(int expired)
expired
- protected void addHeader(java.lang.String key, java.lang.String value)
key
- 键value
- 值public java.lang.String getRequestHost(CosXmlServiceConfig config)
config
- SDK服务配置public void isSupportAccelerate(boolean isSupportAccelerate)
isSupportAccelerate
- 是否启用全球加速public boolean isSupportAccelerate()
public void setSign(java.lang.String sign)
sign
- Authorizationpublic QCloudSignSourceProvider getSignSourceProvider()
public void setSignSourceProvider(QCloudSignSourceProvider cosXmlSignSourceProvider)
cosXmlSignSourceProvider
- 签名原料提供器public STSCredentialScope[] getSTSCredentialScope(CosXmlServiceConfig config)
config
- SDK服务配置@Deprecated public void setSign(long signDuration)
setSignParamsAndHeaders(Set, Set)
方法。@Deprecated public void setSign(long startTime, long endTime)
setSignParamsAndHeaders(Set, Set)
方法。@Deprecated public void setSign(long signDuration, java.util.Set<java.lang.String> parameters, java.util.Set<java.lang.String> headers)
setSignParamsAndHeaders(Set, Set)
方法代替。@Deprecated public void setSign(long startTime, long endTime, java.util.Set<java.lang.String> parameters, java.util.Set<java.lang.String> headers)
setSignParamsAndHeaders(Set, Set)
方法代替。public void setSignParamsAndHeaders(java.util.Set<java.lang.String> parameters, java.util.Set<java.lang.String> headers)
parameters
- 参与签名的参数字段headers
- 参与签名的头部字段public void setRegion(java.lang.String region)
region
- 地域public java.lang.String getRegion()
public void setTask(HttpTask httpTask)
httpTask
- 执行任务public HttpTask getHttpTask()
public int getPriority()
public int getWeight()
public boolean headersHasUnsafeNonAscii()
public void setOnRequestWeightListener(CosXmlRequest.OnRequestWeightListener onRequestWeightListener)
onRequestWeightListener
- 获取请求重量级的监听接口