tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Yohnk <>
Subject "mime-mapping" and Content-Type
Date Mon, 20 Feb 2017 15:38:50 GMT
Hello everyone,

  I’ve come across a problem for which the “mime-mapping” element would be a good solution.
Specifically I have a web application who’s source I can’t change, it’s not returning
a specific Content-Type header and I’d like to start utilizing compression based on the

  Durning my investigation I created a trivial web app for testing but was unable to get the
mime-type specified in the mime-mapping applied to requests sent to the specific extension.
This was with Tomcat 8.0.33. The details can be found below or at the stack overflow post

  As noted in the SO post, I can see that StandardContext:addMimeMapping() is being called
with my specific mapping during initialization. But I’m never seeing the backing mimeMappings
called from there.

  I’ve seen quite a few online posts on this topic but can’t seem find any official documentation
for 8+. Is this feature something that’s still supported? If so, is there something I’m
overlooking in my test or configuration?

  Any light you guys can shine on the subject would be greatly appreciated.



public class SimpleServlet extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
        IOUtils.write("Hello There!", resp.getOutputStream());







cURL request:

curl --trace-ascii - http://localhost:8080/testing.swa
== Info:   Trying ::1...
== Info: TCP_NODELAY set
== Info: Connected to localhost (::1) port 8080 (#0)
=> Send header, 89 bytes (0x59)
0000: GET /testing.swa HTTP/1.1
001b: Host: localhost:8080
0031: User-Agent: curl/7.51.0
004a: Accept: *
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 202 Accepted
<= Recv header, 27 bytes (0x1b)
0000: Server: Apache-Coyote/1.1
<= Recv header, 20 bytes (0x14)
0000: Content-Length: 12
<= Recv header, 37 bytes (0x25)
0000: Date: Wed, 15 Feb 2017 22:37:17 GMT
<= Recv header, 2 bytes (0x2)
<= Recv data, 12 bytes (0xc)
0000: Hello There!
Hello There!== Info: Curl_http_done: called premature == 0
== Info: Connection #0 to host localhost left intact
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message