Missing charset utf in the content-type header in jetty10

7 views
Skip to first unread message

Truong Nguyen Xuan

unread,
Aug 16, 2023, 4:49:19 AM8/16/23
to Codehaus Cargo
Hi,

When upgrading from jetty9 to jetty10, I saw that there was no charset in the content-type header response, tested with the same source.

Jetty9:
Screenshot 2023-08-16 151541.png
Jetty10:
Screenshot 2023-08-15 181957.png

Do you know any way to config it to run as the same with jetty9 (without changing code) ?

Note: as discussed in another thread, I used jetty9 embedded and upgraded to jetty10 standalone configuration.

Thanks,
Truong Nguyen.

Truong Nguyen Xuan

unread,
Aug 16, 2023, 5:03:03 AM8/16/23
to Codehaus Cargo
I also tried to add -Dfile.encoding=UTF-8 to the cargo.start.jvmargs but have no success

S. Ali Tokmen

unread,
Aug 16, 2023, 5:02:25 PM8/16/23
to codehau...@googlegroups.com
Hi Truong

That's most likely a subtle change that happened in Jetty.

- HttpServletResponse.setContentType(String) with a charset can result in the charset being stripped from the header produced (in line with Servlet spec behavior)
- The correct method to use is HttpServletResponse.setCharacterEncoding(String), combined with HttpServletResponse.setMimeType(String)

Does this help? 

--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/2c7d9ba7-ff8e-4568-8260-cefe9105b4bdn%40googlegroups.com.

Nguyen Xuan Truong

unread,
Aug 17, 2023, 4:16:29 AM8/17/23
to codehau...@googlegroups.com
Thanks for replying, Ali.

I have searched and most of them were about changing code, but I don't wanna do that.
And I'm trying to get the reason why there's a difference between jetty9 and jetty10 for the charset.

Thanks again for your help.

Have a nice day,
Truong Nguyen.



--
Impossible = I'm possible!!!

S. Ali Tokmen

unread,
Aug 17, 2023, 5:54:51 AM8/17/23
to codehau...@googlegroups.com
Hi Truong

How Jetty programs their software is beyond Codehaus Cargo's scope.
Reply all
Reply to author
Forward
0 new messages