简体   繁体   English

即使不是文本MIME类型,Undertow也会始终向Content-Type标头添加charset

[英]Undertow always add charset to Content-Type header even if it is not a text MIME type

If I try to set the content type to "image/jpg" in a servlet 如果我尝试在servlet中将内容类型设置为“image / jpg”

response.setContentType("image/jpg")

I get 我明白了

Content-Type: image/jpg;charset=ISO-8859-1

The default servlet works well instead. 默认的servlet运行良好。

How can I get rid of charset for non text mime types? 如何摆脱非文本mime类型的字符集?

问题是我使用resp.getWriter()而不是resp.getOutputStream()来提供图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Java 中解析 Content-Type 标头而不验证字符集 - Parsing a Content-Type header in Java without validating the charset 是内容类型“text/xml; 字符集=utf-8”错了吗? - Is content-type “text/xml; charset=utf-8” wrong? 如何在IBM HTTPD服务器上设置Content-Type HTTP标头的字符集部分? - How do I set the charset portion of the Content-Type HTTP Header on an IBM HTTPD Server? Java应用程序服务器如何决定在HTTP Content-type标头中发送什么字符集? - How does a Java application server decide what charset to send in the HTTP Content-type header? 如何在 Spring boot(v2.4.2) 中从 Content-Type 响应头中删除 charset=UTF-8 - How to remove charset=UTF-8 from Content-Type response header in Spring boot(v2.4.2) Firefox甚至尝试使用Content-Type解析XML:text / plain - Firefox tries to parse XML even with Content-Type: text/plain Jersey客户端将内容类型标题设置为text / plain - Jersey Client set content-type header as text/plain 如何在Soap Web服务中添加“内容类型”标头 - How to add “content-type” header in soap webservice 不支持的内容类型:text / html; charset = UTF-8支持的是:Jdev中的[text / xml] - Unsupported Content-Type: text/html; charset=UTF-8 Supported ones are: [text/xml] in Jdev 无法将内容类型标头添加到SSE端点 - Unable to add Content-Type Header to SSE endpoint
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM