How do I configure Jetty (via jettyrunner) so that it names a character set in the Content-Type response header?

Posted by Pointy on Server Fault See other posts from Server Fault or by Pointy
Published on 2011-01-13T18:00:43Z Indexed on 2011/01/13 18:55 UTC
Read the original article Hit count: 191

I use Jetty (via the oh-so-handy Jetty Runner) for day-to-day web application testing. One thing I've recently stumbled on is the fact that I don't get a character set called out in the "Content-Type" response header all the time. I do get it in response to my application's XMLHttpRequest transactions, but not for plain old pages loaded by <a> links or whatever.

I've read a little bit about how to set up a Jetty config file, but I've never been able to completely understand that; all servlet containers are complicated, and while Jetty is pretty simple it's just weird enough that I don't grok the overall idea. Thus, all I do to launch my app is to run the Jetty Runner .jar file with a couple of simple arguments to set up the port number and logfile path, and then I just give it the .war file to run. It works great — except for the missing character set :-)

Anybody have a quick sample config file that might fix this?

edit — oh if it matters, I'm running Jetty 7.0.0 RC3; I've also tried with a slightly newer version (still 7.something) with exactly the same issue. All my testing is on Ubuntu.

© Server Fault or respective owner

Related posts about configuration

Related posts about http-headers