Package com.qiniu.http
Class Client
- java.lang.Object
- 
- com.qiniu.http.Client
 
- 
 public final class Client extends java.lang.Object定义HTTP请求管理相关方法
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringContentTypeHeaderstatic java.lang.StringDefaultMimestatic java.lang.StringFormMimestatic java.lang.StringJsonMime
 - 
Constructor SummaryConstructors Constructor Description Client()构建一个默认配置的 HTTP Client 类Client(Dns dns, boolean hostFirst, ProxyConfiguration proxy, int connTimeout, int readTimeout, int writeTimeout, int dispatcherMaxRequests, int dispatcherMaxRequestsPerHost, int connectionPoolMaxIdleCount, int connectionPoolMaxIdleMinutes)构建一个自定义配置的 HTTP Client 类Client(Configuration cfg)Client(Configuration cfg)构建一个自定义配置的 HTTP Client 类
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidasyncMultipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, byte[] fileBody, java.lang.String mimeType, StringMap headers, AsyncCallback cb)voidasyncMultipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, java.io.File fileBody, java.lang.String mimeType, StringMap headers, AsyncCallback cb)voidasyncPost(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType, AsyncCallback cb)voidasyncSend(okhttp3.Request.Builder requestBuilder, StringMap headers, AsyncCallback cb)Responsedelete(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType)Responsedelete(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType)Responsedelete(java.lang.String url, StringMap headers)Responsedelete(java.lang.String url, okhttp3.RequestBody body, StringMap headers)Responseget(java.lang.String url)Responseget(java.lang.String url, StringMap headers)ResponsemultipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, byte[] fileBody, java.lang.String mimeType, StringMap headers)ResponsemultipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, java.io.File fileBody, java.lang.String mimeType, StringMap headers)Responsepatch(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType)Responsepatch(java.lang.String url, byte[] body, StringMap headers)Responsepatch(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType)Responsepatch(java.lang.String url, StringMap params, StringMap headers)Responsepatch(java.lang.String url, java.lang.String body, StringMap headers)Responsepost(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType)Responsepost(java.lang.String url, byte[] body, StringMap headers)Responsepost(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType)Responsepost(java.lang.String url, StringMap params, StringMap headers)Responsepost(java.lang.String url, java.lang.String body, StringMap headers)Responsepost(java.lang.String url, okhttp3.RequestBody body, StringMap headers)Responseput(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType)Responseput(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType)Responseput(java.lang.String url, okhttp3.RequestBody body, StringMap headers)Responsesend(okhttp3.Request.Builder requestBuilder, StringMap headers)static voidsetAppName(java.lang.String userApp)
 
- 
- 
- 
Field Detail- 
ContentTypeHeaderpublic static final java.lang.String ContentTypeHeader - See Also:
- Constant Field Values
 
 - 
DefaultMimepublic static final java.lang.String DefaultMime - See Also:
- Constant Field Values
 
 - 
JsonMimepublic static final java.lang.String JsonMime - See Also:
- Constant Field Values
 
 - 
FormMimepublic static final java.lang.String FormMime - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
Clientpublic Client() 构建一个默认配置的 HTTP Client 类
 - 
Clientpublic Client(Configuration cfg) 构建一个自定义配置的 HTTP Client 类- Parameters:
- cfg- 配置信息
 
 - 
Clientpublic Client(Configuration cfg) 
 - 
Clientpublic Client(Dns dns, boolean hostFirst, ProxyConfiguration proxy, int connTimeout, int readTimeout, int writeTimeout, int dispatcherMaxRequests, int dispatcherMaxRequestsPerHost, int connectionPoolMaxIdleCount, int connectionPoolMaxIdleMinutes) 构建一个自定义配置的 HTTP Client 类- Parameters:
- dns- dns 解析类
- hostFirst- 是否优先使用 host
- proxy- 代理
- connTimeout- 链接超时
- readTimeout- 读超时
- writeTimeout- 写超时
- dispatcherMaxRequests- 并发最大请求数
- dispatcherMaxRequestsPerHost- 单 Host 并发最大请求数
- connectionPoolMaxIdleCount- 连接池中请求最大空闲数
- connectionPoolMaxIdleMinutes- 连接池中请求最大空闲分钟数
 
 
- 
 - 
Method Detail- 
setAppNamepublic static void setAppName(java.lang.String userApp) 
 - 
getpublic Response get(java.lang.String url) throws QiniuException - Throws:
- QiniuException
 
 - 
getpublic Response get(java.lang.String url, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
deletepublic Response delete(java.lang.String url, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
deletepublic Response delete(java.lang.String url, okhttp3.RequestBody body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
deletepublic Response delete(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
deletepublic Response delete(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
postpublic Response post(java.lang.String url, byte[] body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
postpublic Response post(java.lang.String url, java.lang.String body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
postpublic Response post(java.lang.String url, StringMap params, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
postpublic Response post(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
putpublic Response put(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
putpublic Response put(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
postpublic Response post(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
postpublic Response post(java.lang.String url, okhttp3.RequestBody body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
putpublic Response put(java.lang.String url, okhttp3.RequestBody body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
multipartPostpublic Response multipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, byte[] fileBody, java.lang.String mimeType, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
multipartPostpublic Response multipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, java.io.File fileBody, java.lang.String mimeType, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
patchpublic Response patch(java.lang.String url, byte[] body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
patchpublic Response patch(java.lang.String url, java.lang.String body, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
patchpublic Response patch(java.lang.String url, StringMap params, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
patchpublic Response patch(java.lang.String url, byte[] body, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
patchpublic Response patch(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType) throws QiniuException - Throws:
- QiniuException
 
 - 
sendpublic Response send(okhttp3.Request.Builder requestBuilder, StringMap headers) throws QiniuException - Throws:
- QiniuException
 
 - 
asyncSendpublic void asyncSend(okhttp3.Request.Builder requestBuilder, StringMap headers, AsyncCallback cb)
 - 
asyncPostpublic void asyncPost(java.lang.String url, byte[] body, int offset, int size, StringMap headers, java.lang.String contentType, AsyncCallback cb)
 - 
asyncMultipartPostpublic void asyncMultipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, byte[] fileBody, java.lang.String mimeType, StringMap headers, AsyncCallback cb)
 - 
asyncMultipartPostpublic void asyncMultipartPost(java.lang.String url, StringMap fields, java.lang.String name, java.lang.String fileName, java.io.File fileBody, java.lang.String mimeType, StringMap headers, AsyncCallback cb) throws QiniuException- Throws:
- QiniuException
 
 
- 
 
-