-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

David,

On 12/28/13, 12:06 PM, David Law wrote:
> Tomcat doesn't seem to serve compressed SVG's (*.svgz) correctly. 
> The response should have a Content-Encoding header, value 'gzip'.
> 
> Any chance of getting this at long last? (a change to
> org.apache.catalina.servlets.DefaultServlet, I presume)
> 
> Version: 7.0.47

What type of data do you have on the disk? What content-type? What
content-type and content-encoding are sent to the browser?

Tomcat's DefaultServlet should serve any file using gzip (with an
appropriate content-encoding) that matches the configured mime types
and isn't smaller than a certain size. All of these can be configured
with the compression, compressableMimeType, and compressionMinSize
attributes on your <Connector>. Note that use of sendFile precludes
the use of gzip compression, so if you are using sendFile you aren't
going to get that kind of encoding.

- From a stock Tomcat install, to get .svg files served using
content-encoding:gzip, you'd need to modify your <Connector> to have
the following attributes:

   compression="on"
   compressableMimeType="...., image/svg+xml"
   compressionMinSize="[big enough to exceed your file size"
   sendFile="false" (if appropriate)

If the file is already compressed, then Tomcat will not re-compress
it, and won't use the content-encoding:gzip header because it's not
appropriate: the server is serving compressed content, not merely
compressing the content for transfer.

If you want to serve pre-compressed content then you'll have to do
some work yourself (unless you are using Tomcat 8). There have been a
few discussions on the various lists over the past few years. For example,

http://markmail.org/message/w2kpjqibrkxmxmup
http://markmail.org/thread/h5kyjofpkglpkfks

Tomcat 8.0.4-RC4+ should already support pre-compressed files:
https://issues.apache.org/bugzilla/show_bug.cgi?id=54095

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSvxmeAAoJEBzwKT+lPKRYHGoP/2AOOw9SDDdrh7SKEfQcjPF5
PYS+dzttdVA+0Gn5Kgm/i7VVzsqAiZ+OHFmN/pMqkDAyqFOKwDADzQ+hS2akp1yw
bbL6lFVkWX1TwiDBRh23JIV5ljCZRioVBDJtj+novk0ITBHAC73RdA4uJ1MpLsVX
wtXHBPamRjc2m5H1r5UBI/ZqUgM3Oa6WB8MUTgXddcZZJkaTkHUHzvmSJmkfe/zy
kgzGy1vFUw7jeEejEMLMcT6MZ3/Y1+T2IMOu6P90KojJa9jxSynb1gEEgT5t5aRX
e/i5VJlCunIHS8YX3B/LOhdSK0dfOgV4mjVl+v/YpWBi3YALpuNiBMX4PygUDaxW
uRO21Sz+3KP9oNvSuTmc+dZj3wShiVN2Cjve2pqHmI/7O6PWZmfwODDgoS7TpaFV
Cfmkpp6fhCRCjr4ckV5/v1RELQF4xIL8NnMbRIfvlwsBbIGP4XMf7OQsyjpXsYKQ
gHrkJv/U2yePrzExLcPVoHEoxFWQ9I0VMHpJSLdX+PZQQx38wx7aNg/P7X6Sq7oe
nRO0x/L7nKGarjB3ldXoPMoKEywym0X9lr0vDbPs7tT67igNXrcfKrMH+arMfabm
SukIDDGkq6fjOtfLAq9VHGvvk6i3VBjY3m+WExQ/TvTrHWfKoep2em+ExtUxSRMn
v6WvKDaLa9w5n+NjCNXU
=9hiN
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to