Package | Description |
---|---|
cn.hutool.http |
Hutool-http针对JDK的HttpUrlConnection做一层封装,简化了HTTPS请求、文件上传、Cookie记忆等操作,使Http请求变得无比简单。
|
cn.hutool.http.webservice |
Webservice客户端封装实现
|
Modifier and Type | Method and Description |
---|---|
HttpResponse |
HttpResponse.body(byte[] bodyBytes)
设置主体字节码
需在此方法调用前使用charset方法设置编码,否则使用默认编码UTF-8 |
HttpResponse |
HttpRequest.execute()
执行Reuqest请求
|
HttpResponse |
HttpRequest.execute(boolean isAsync)
执行Reuqest请求
|
HttpResponse |
HttpRequest.executeAsync()
|
HttpResponse |
HttpResponse.sync()
同步
如果为异步状态,则暂时不读取服务器中响应的内容,而是持有Http链接的 InputStream 。当调用此方法时,异步状态转为同步状态,此时从Http链接流中读取body内容并暂存在内容中。如果已经是同步状态,则不进行任何操作。 |
Modifier and Type | Method and Description |
---|---|
HttpConfig |
HttpConfig.addResponseInterceptor(HttpInterceptor<HttpResponse> interceptor)
设置拦截器,用于在请求前重新编辑请求
|
HttpRequest |
HttpRequest.addResponseInterceptor(HttpInterceptor<HttpResponse> interceptor)
设置拦截器,用于在请求前重新编辑请求
|
GlobalInterceptor |
GlobalInterceptor.addResponseInterceptor(HttpInterceptor<HttpResponse> interceptor)
设置拦截器,用于在响应读取后完成编辑或读取
|
void |
HttpRequest.then(Consumer<HttpResponse> consumer)
执行Request请求后,对响应内容后续处理
处理结束后关闭连接 |
<T> T |
HttpRequest.thenFunction(Function<HttpResponse,T> function)
执行Request请求后,对响应内容后续处理
处理结束后关闭连接 |
Constructor and Description |
---|
HttpInputStream(HttpResponse response)
构造
|
Modifier and Type | Method and Description |
---|---|
HttpResponse |
SoapClient.sendForResponse()
发送请求,获取异步响应
|
Copyright © 2024. All rights reserved.