| Author |
Can I set specific HTTP Content-Type encoding headers in web.xml?
|
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
With my webapp, I have plain static .css files. Is there any way I can configure web.xml so that they are delivered with an HTTP Content-Type header of "text/css;charset=UTF-8" (rather than just "text/css").
Thanks,
James
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
In Tomcat, the default web.xml defines the mime-mapping for files with css extension.
If you are using Tomcat, changing that entry should redefine the default content type - try it and see.
Bill
|
Java Resources at www.wbrogden.com
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
Thanks Bill,
Adding...
...(just before my <welcome-file-list> element) did the trick.
Cheers,
James
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
...I thought that had worked, but it hadn't. When I fixed the error in that code, making it:
then "Content-Type: text/css;charset=UTF-8" isn't sent with the response, only "Content-Type: text/css" is.
Is this the solution you meant, Bill, or have I misunderstood? Could you send me a web.xml code snippet that would make the "Content-Type: text/css;charset=UTF-8" header be sent with css files?
Thanks,
James
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
Sorry, thats the only configuration setting I know of that controls content type headers.
Bill
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
|
OK Bill, thanks anyway.
|
 |
 |
|
|
subject: Can I set specific HTTP Content-Type encoding headers in web.xml?
|
|
|