Comments (10)
你可以使用HttpRequest
构建请求:
HttpUtil.createGet(url, true)
.timeout(timeout)
.executeAsync()
..bodyBytes()
from hutool.
主要是我觉得既然提供了对应的api其实就应该更加完善,提供一个选项或者使用全局默认。如果不能加超时时间,downloadBytes其实就没存在的必要了,因为都走上述您提供的代码就可以了,并且可以完美避坑。
from hutool.
@sanyou3 全局配置可见:HttpGlobalConfig.setTimeout()
from hutool.
这个也改变不了downloadBytes阻塞的问题。。。
from hutool.
@sanyou3 我这边没有更好的办法了……欢迎提供思路。
from hutool.
我建议可以在下个版本加一个重载方法,嘿嘿。
from hutool.
@sanyou3 加个超时时间么?这个和全局设置是一样的,既然解决不了阻塞问题,那加个重载也没有意义吧。
from hutool.
您没懂我的意思,之所以阻塞是因为没有超时时间,设置超时时间就没这个问题了。HttpGlobalConfig.setTimeout()设置的超时时间目前无法作用到downloadBytes方法,所以我说HttpGlobalConfig.setTimeout()没用。加个重载方法或者让downloadBytes能够使用HttpGlobalConfig.setTimeout()这个全局配置就可以了。
from hutool.
@sanyou3 sorry,明白了,脑袋蒙住了。我看了源码,确实没有使用全局的超时。
这是个bug。
5.8.28会:
- 修复全局超时在download中无效的问题
- 增加超时重载方法。
from hutool.
嘿嘿。
from hutool.
Related Issues (20)
- 关于JSONUtil序列化Optinal为空字典的问题,有办法可以获取到optional的值吗 HOT 2
- 有没有把inputstream下载到浏览器文件的方法 HOT 1
- 类似jackson的@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 的注解 HOT 1
- cn.hutool.json.JSONUtil#toBean(java.lang.String, java.lang.Class<T>) 字符串转Bean,@Alias(cn.hutool.core.annotation.Alias)别名注解解析嵌套多层结构数据异常!!! HOT 3
- cron 错误 栈溢出 HOT 1
- LRU Cache 并发get HOT 1
- outlook 邮件发送是否支持 Oath2 认证方式 HOT 2
- BeanUtil.copyProperties导致积压class不回收 HOT 11
- 打jar包后fileutils的exist方法找不到resource目录下的文件下,怎么解决呢 HOT 1
- GraphicsUtil 接口变化,导致不兼容旧版本 HOT 1
- JSONUtil.toBean字符串转日期会报错 HOT 1
- 升级5.8.30后ZipUtil压缩成流的方法报错、5.8.29没问题 HOT 3
- [poi] [excel] ExcelReader调用read读取日期时,第一行数据类型是String,第二行开始是DateTime HOT 2
- FileUtils网络路径支持存在问题 HOT 1
- CompressUtil.createExtractor解压缩文件的问题
- 5.8 之后的版本,空字符串替换失效; HOT 16
- 类型转换数据异常 HOT 2
- BeanUtil 报错 HOT 4
- 双引号问题 HOT 1
- DateUtil.parse 时间戳格式化报错 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hutool.