博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Jsoup下载图片报错:UnsupportedMimeTypeException
阅读量:6969 次
发布时间:2019-06-27

本文共 483 字,大约阅读时间需要 1 分钟。

hot3.png

    使用Jsoup下载图片时,报错:不支持MimeType异常。

Response request = Jsoup.connect(url)				.referrer(url).userAgent("Mozilla/5.0 ...")				.execute();

    后面,在connect(url)后面加了一行:ignoreContentType(true):Ignore the document's Content-Type when parsing the response. 文档意思是当解析请求的时候忽略ContentType。

Response request = Jsoup.connect(url)				.ignoreContentType(true)// 此处解决UnsupportedMimeTypeException异常				.referrer(url).userAgent("Mozilla/5.0 ...")				.execute();

 

转载于:https://my.oschina.net/javamaster/blog/1613747

你可能感兴趣的文章
ApiController使用Session验证出现Null解决方案
查看>>
【剑指offer】包括min函数的栈
查看>>
点云匹配和ICP算法概述
查看>>
ACdream 1083 有向无环图dp
查看>>
大众点评的实时计算
查看>>
Thrift反序列化导致OOM(转)
查看>>
【转载】谷歌酝酿将苹果Swift作为安卓APP主要开发语言
查看>>
自定义用户登录,会话保持,登录后自动跳转原页面
查看>>
Quartz的cronTrigger表达式
查看>>
李洪强经典iOS面试题11
查看>>
Ubuntu 14 常用“快捷键”,Ctrl + Alt + F1 进入终端,按 Ctrl + Alt + F7 回到界面
查看>>
知乎上关于游戏引擎的讨论
查看>>
挂单盯盘核心——从买盘和卖盘看庄家意图
查看>>
Atitit 知识图谱的数据来源
查看>>
解决:error: Cannot fetch repo (TypeError: expected string or buffer)
查看>>
netty Failed to submit an exceptionCaught() event异常
查看>>
oracle 11g RAC 的一些基本概念(三)
查看>>
api数据接口
查看>>
软件测试--测试Demo
查看>>
买房的贷款时间是否是越长越好?https://www.zhihu.com/question/20842791
查看>>