You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Victor Rodriguez <vi...@gmail.com> on 2015/03/09 20:12:45 UTC

[URGENT] Content-Encoding: gzip not set

Greetings,

I have some ALREADY gzipped files that I'm trying to serve up.

I have the following in my web.xml.

<mime-mapping>
    <extension>json</extension>
    <mime-type>application/gzip</mime-type>
</mime-mapping>


And, I have the following in my server.xml:

<Context docBase="/path/to/already-gzipped-json" path="/already-gzipped-json" />


>From the command line, I can curl the files and gunzip them just fine, so
they are coming across gzipped:

curl http://localhost:8082/already-gzipped-json/fie.json | gunzip -

However, requests coming from a web browser aren't handled correctly and
aren't legible in the browser, and I believe it's because Content-Encoding:
gzip is not in the response headers.

curl -I http://localhost:8082/already-gzipped-json/fie.json

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
Last-Modified: Mon, 09 Mar 2015 17:15:29 GMT
Content-Type: application/gzip
Content-Length: 17905
Date: Mon, 09 Mar 2015 19:11:06 GMT

How do I tell Tomcat to include the Content-Encoding: gzip response
header?  Again, these area ALREADY zipped files.  I'm not interested in
Tomcat doing the gziping on the fly.

Thanks!
-- 
Sent from neither my iPhone nor my iPad.

Re: [URGENT] Content-Encoding: gzip not set

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Victor,

On 3/9/15 3:12 PM, Victor Rodriguez wrote:
> I have some ALREADY gzipped files that I'm trying to serve up.

See Mark's reply for how to do what you are trying to do. I'd like to
comment, here, though.

> I have the following in my web.xml.
> 
> <mime-mapping> <extension>json</extension> 
> <mime-type>application/gzip</mime-type> </mime-mapping>
> 
> And, I have the following in my server.xml:
> 
> <Context docBase="/path/to/already-gzipped-json"
> path="/already-gzipped-json" />
> 
> From the command line, I can curl the files and gunzip them just
> fine, so they are coming across gzipped:
> 
> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip
> -
> 
> However, requests coming from a web browser aren't handled
> correctly and aren't legible in the browser, and I believe it's
> because Content-Encoding: gzip is not in the response headers.

Nor should it be: the file is a gzipped file; it's not being sent in
"gzip" encoding. You are confusing the two concepts.

If you request a web resource, what you get is what's on the server's
disk. If that content is gzipped, you'll get a gzipped file. If it's
not, you don't.

Content-Encoding: gzip means that the original file is being
compressed for transit, but that the original file is not
(necessarily) in gzipped format.

> curl -I http://localhost:8082/already-gzipped-json/fie.json
> 
> HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Accept-Ranges: bytes 
> Last-Modified: Mon, 09 Mar 2015 17:15:29 GMT Content-Type:
> application/gzip Content-Length: 17905 Date: Mon, 09 Mar 2015
> 19:11:06 GMT
> 
> How do I tell Tomcat to include the Content-Encoding: gzip
> response header?  Again, these area ALREADY zipped files.  I'm not
> interested in Tomcat doing the gziping on the fly.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU/hGXAAoJEBzwKT+lPKRY5JIP/iP0JhQXUeYqc36vwPIBfd8I
gIF59ZaSYzEifUFSTDGNe9YBhBtctVgpl+EB2RPIq3ICbC88SQhdaIFAqm+jyv9t
WpY62P+ZF5oRB36agYiGZl897KcC5nVvXVJ3wW3wkdT9jjRqtquV0idIdXEEjtCX
UUloa6YBqxz0LtrRzQYI4jGlK/sVGE9i1OraTJ5LbkDbE8KC7wtEB3/s6ptXRalr
VnTc1bofc/9HrlXKBqghr9Z13PXPLSXuJ5dih4TSO8rBQyw4J/rQD8lD/LPprxXB
BKNEUNCTWMuGjXtisDrcMkPPiNZTcFMuYbLDtzift7i2RGPbPuLLKt6ZiytncCjs
+EG6xkh2NRJVydUqQreIA+1n4ToLNApbI5+xt6FcIlEoftHrnrNA2vel2rUICj+n
Em/Eavt6L2IzkVUXOwWWjpVyqG0NXAJseL08itoMuKzTZZvXAtObc+EtL/zQzUaU
fC3Fz68U9HcQj6Zc7NmzHNihjOlb/wCswI32iuV0LZa4mN0qi3HCFEREOx4ijlnZ
/B/E+EWCZl4beICSAO6QFpWCHNm0m2FVKglD5vSLprxOwSqnTk0UR/WHf3aVWv97
GAx0iDrDtvZJRBnyVrdx0nD99hJBsDyYXl4KzMx/8m/yyuH4mTDLGnNqMjPpT1xT
d0l9sHubJaWratZJ9d1T
=flBL
-----END PGP SIGNATURE-----

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


RE: [URGENT] Content-Encoding: gzip not set

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com] 
> Subject: Re: [URGENT] Content-Encoding: gzip not set

> > > If there's something that drives me absolutely nuts it's people
> > > that say "read the documentation" when you ask them for help.

> It's a pity in a way. I'm sure that your response would have been enjoyable.

> But +1 too. Chris beat us both to it, and his response is a wonder of ponderation.
> I would have added something about using free software provided by experts and free help 
> provided by experts, and about wasting their time by not using the free documentation also 
> provided by experts; and also about the bad health effects of increased blood pressure.

I had some of that as well, along with a hope that the OP enjoys his life of insanity...

But Chris' was better.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by André Warnier <aw...@ice-sa.com>.
Mark Thomas wrote:
> On 09/03/2015 21:53, Christopher Schultz wrote:
>> Victor,
>>
>> On 3/9/15 5:44 PM, Victor Rodriguez wrote:
>>> Brilliant Chris!  However, if it were that easy, I would have
>>> already found it and figured it out.  That's why I'm asking the
>>> experts on this list for HELP!  Not for someone to tell me that "I
>>> ought to read the documentation for the feature I'm trying to use."
>>> If there's something that drives me absolutely nuts it's people
>>> that say "read the documentation" when you ask them for help.
>>> Apparently, IIS can be easily configured to do this, but we don't
>>> use IIS around here, so I have to figure out how to do it with
>>> Tomcat and/or Apache.  And so far, the documentation hasn't given
>>> me the solution for either case.
>>> Can you possibly point me to the right place in the documentation?
>>> Thanks!
>> Hmm...
>>
>>> On 3/9/15 4:01 PM, Mark Thomas wrote:
>>>> Add .gz to the end of the file name and set gzip="true" for the 
>>>> default servlet.
>> User Guide > Default Servlet > search the page for "gzip" > read the
>> description for what "gzip" does.
>>
>> I apologize for the difficulty level involved with finding that
>> documentation.
>>
>> *facepalm*
>>
>> Mark's response was a no-BS, cut-to-the-solution response, and you
>> didn't like it. Why, I'm not sure.
>>
>> If there's something that drives me absolutely nuts it's people who
>> say "help me with my URGENT problem, but no, I won't tell what version
>> of the software I'm running and when you tell me the answer I'll
>> discard it out of hand after jumping to conclusions about how it works."
> 
> +1. Thanks Chris. That is far better than the response I'd been
> composing in my head.

It's a pity in a way. I'm sure that your response would have been enjoyable.

But +1 too. Chris beat us both to it, and his response is a wonder of ponderation.
I would have added something about using free software provided by experts and free help 
provided by experts, and about wasting their time by not using the free documentation also 
provided by experts; and also about the bad health effects of increased blood pressure.

> 
> I await the OP's response with interest.

+1



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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Mark Thomas <ma...@apache.org>.
On 09/03/2015 21:53, Christopher Schultz wrote:
> Victor,
> 
> On 3/9/15 5:44 PM, Victor Rodriguez wrote:
>> Brilliant Chris!  However, if it were that easy, I would have
>> already found it and figured it out.  That's why I'm asking the
>> experts on this list for HELP!  Not for someone to tell me that "I
>> ought to read the documentation for the feature I'm trying to use."
>> If there's something that drives me absolutely nuts it's people
>> that say "read the documentation" when you ask them for help.
> 
>> Apparently, IIS can be easily configured to do this, but we don't
>> use IIS around here, so I have to figure out how to do it with
>> Tomcat and/or Apache.  And so far, the documentation hasn't given
>> me the solution for either case.
> 
>> Can you possibly point me to the right place in the documentation?
>> Thanks!
> 
> Hmm...
> 
>> On 3/9/15 4:01 PM, Mark Thomas wrote:
>>> Add .gz to the end of the file name and set gzip="true" for the 
>>> default servlet.
> 
> User Guide > Default Servlet > search the page for "gzip" > read the
> description for what "gzip" does.
> 
> I apologize for the difficulty level involved with finding that
> documentation.
> 
> *facepalm*
> 
> Mark's response was a no-BS, cut-to-the-solution response, and you
> didn't like it. Why, I'm not sure.
> 
> If there's something that drives me absolutely nuts it's people who
> say "help me with my URGENT problem, but no, I won't tell what version
> of the software I'm running and when you tell me the answer I'll
> discard it out of hand after jumping to conclusions about how it works."

+1. Thanks Chris. That is far better than the response I'd been
composing in my head.

I await the OP's response with interest.

Mark

> 
> -chris
> 
>> On Mon, Mar 9, 2015 at 3:33 PM, Christopher Schultz < 
>> chris@christopherschultz.net> wrote:
> 
>> Victor,
> 
>> On 3/9/15 5:25 PM, Victor Rodriguez wrote:
>>>>> Thanks Mark!  Unfortunately, that is not an option.  The
>>>>> client will be requesting the files without the .gz
>>>>> extension.
>>>>>
>>>>> On Mon, Mar 9, 2015 at 2:01 PM, Mark Thomas
>>>>> <ma...@apache.org> wrote:
>>>>>
>>>>>> On 09/03/2015 19:12, Victor Rodriguez wrote:
>>>>>>
>>>>>>> How do I tell Tomcat to include the Content-Encoding:
>>>>>>> gzip response header?  Again, these area ALREADY zipped
>>>>>>> files.  I'm not interested in Tomcat doing the gziping on
>>>>>>> the fly.
>>>>>>
>>>>>> Add .gz to the end of the file name and set gzip="true" for
>>>>>> the default servlet.
> 
>> If the client will be requesting the files without a .gz
>> extension, then ... you really ought to read the documentation for
>> the feature you are trying to use.
> 
>> -chris
>>>
>>> ---------------------------------------------------------------------
>>>
>>>
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Victor,

On 3/9/15 5:44 PM, Victor Rodriguez wrote:
> Brilliant Chris!  However, if it were that easy, I would have
> already found it and figured it out.  That's why I'm asking the
> experts on this list for HELP!  Not for someone to tell me that "I
> ought to read the documentation for the feature I'm trying to use."
> If there's something that drives me absolutely nuts it's people
> that say "read the documentation" when you ask them for help.
> 
> Apparently, IIS can be easily configured to do this, but we don't
> use IIS around here, so I have to figure out how to do it with
> Tomcat and/or Apache.  And so far, the documentation hasn't given
> me the solution for either case.
> 
> Can you possibly point me to the right place in the documentation?
> Thanks!

Hmm...

> On 3/9/15 4:01 PM, Mark Thomas wrote:
>> Add .gz to the end of the file name and set gzip="true" for the 
>> default servlet.

User Guide > Default Servlet > search the page for "gzip" > read the
description for what "gzip" does.

I apologize for the difficulty level involved with finding that
documentation.

*facepalm*

Mark's response was a no-BS, cut-to-the-solution response, and you
didn't like it. Why, I'm not sure.

If there's something that drives me absolutely nuts it's people who
say "help me with my URGENT problem, but no, I won't tell what version
of the software I'm running and when you tell me the answer I'll
discard it out of hand after jumping to conclusions about how it works."

- -chris

> On Mon, Mar 9, 2015 at 3:33 PM, Christopher Schultz < 
> chris@christopherschultz.net> wrote:
> 
> Victor,
> 
> On 3/9/15 5:25 PM, Victor Rodriguez wrote:
>>>> Thanks Mark!  Unfortunately, that is not an option.  The
>>>> client will be requesting the files without the .gz
>>>> extension.
>>>> 
>>>> On Mon, Mar 9, 2015 at 2:01 PM, Mark Thomas
>>>> <ma...@apache.org> wrote:
>>>> 
>>>>> On 09/03/2015 19:12, Victor Rodriguez wrote:
>>>>> 
>>>>>> How do I tell Tomcat to include the Content-Encoding:
>>>>>> gzip response header?  Again, these area ALREADY zipped
>>>>>> files.  I'm not interested in Tomcat doing the gziping on
>>>>>> the fly.
>>>>> 
>>>>> Add .gz to the end of the file name and set gzip="true" for
>>>>> the default servlet.
> 
> If the client will be requesting the files without a .gz
> extension, then ... you really ought to read the documentation for
> the feature you are trying to use.
> 
> -chris
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU/hZkAAoJEBzwKT+lPKRYPVUQAIqw0xqgawpUZPVPc8OakaI+
It/4M173o1LyCLHC6gzWLkYM9Kuv8KlGpzou/XAa+c1Oiyr499nblPiuewSak4wt
IghlIjKcSGOWke3w7lc5KbVjUej3Jkj32cUQDWuSZ2+iSZxdyO7KQ6Zs1gTcHqaL
5uJRjr6ODfn5+NRAyTq4k04Rq/XBfERzC6SpA91LwjmX2XMx557A5jhqSZ88vlQC
lZfWeffc6V5Hy920xzxwzb4K7d6QBWHNNh94m6aUCtDzhzw5wzlnDnB0gv5RIEQw
+8nRRt3L64MvIJdVWDiOi+OewEnZwHlAtmYllWp+hFrN3NahHpmb2xOAjpFZYiAX
FzjeC+ObVzhrWdDpuJ2M2spemCBAGbbLieUMrVDWq/ePuFkK6r2EqxGJtOVEmFdW
LgPub4HqBP3mgDBRubBsKNjPw3FagqH3Y+7GOumyhENMdWhNLnNBS+Yo6naIe3Ym
l9S062gH2azJW2K/1loXnIOrIN0ejdeodUKiokBpcsgjL/jImBcxQULcyioTNy9+
67F46rU/rmTB8eJ+iGz1jDIUDeXtydS4Po2JUZl4JpqzzV/wHcVkmnXrv3PM+g3v
ePAgNQHVjs20K6ZykYZ45IO4yTgkbwH8Ug2mDMh24piVNVDrP4nFNfDfv1zm5lV4
Hepm/T1Zv2rP4dHPXspa
=o28h
-----END PGP SIGNATURE-----

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
Brilliant Chris!  However, if it were that easy, I would have already found
it and figured it out.  That's why I'm asking the experts on this list for
HELP!  Not for someone to tell me that "I ought to read the documentation
for the feature I'm trying to use."  If there's something that drives me
absolutely nuts it's people that say "read the documentation" when you ask
them for help.

Apparently, IIS can be easily configured to do this, but we don't use IIS
around here, so I have to figure out how to do it with Tomcat and/or
Apache.  And so far, the documentation hasn't given me the solution for
either case.

Can you possibly point me to the right place in the documentation?  Thanks!

On Mon, Mar 9, 2015 at 3:33 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Victor,
>
> On 3/9/15 5:25 PM, Victor Rodriguez wrote:
> > Thanks Mark!  Unfortunately, that is not an option.  The client
> > will be requesting the files without the .gz extension.
> >
> > On Mon, Mar 9, 2015 at 2:01 PM, Mark Thomas <ma...@apache.org>
> > wrote:
> >
> >> On 09/03/2015 19:12, Victor Rodriguez wrote:
> >>
> >>> How do I tell Tomcat to include the Content-Encoding: gzip
> >>> response header?  Again, these area ALREADY zipped files.  I'm
> >>> not interested in Tomcat doing the gziping on the fly.
> >>
> >> Add .gz to the end of the file name and set gzip="true" for the
> >> default servlet.
>
> If the client will be requesting the files without a .gz extension,
> then ... you really ought to read the documentation for the feature
> you are trying to use.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJU/hHFAAoJEBzwKT+lPKRYIvUP/iXLC0HnWav5EdZlMG2KnlSs
> MmVwikA7yoBLznMGcUSPNYhH8os6NKLusUltsxl8iWvGLCvxhNinNKSMShKOGby7
> glXQ0o6Y0c2XCAiOCP0xv11RZNHjm+EZH1nrD8ZJoPegIrdxWXnO/P3Odx/3lNLn
> PKt6M2TjEtzoBXy3V2QgXziOk/7ike5DHwZTi/NMIkV+e0OBrdqBgPlJPGMPngJU
> 5kmPQ7WSf3GlrkSw4ougIiKZAXqHHm27BlKkgO0pAn5qe78FcV0QCdfisLeXsU2o
> frfuKAIpiVjsqmnSC9WHA8L4A2z2Pyma22thNjfZTRcCnyzXHsYDsfIafXed6V0N
> oobXuXeOy/vtYEB6DulfJe6uxvfn5mD2YkTGNQjY4XbGuozlU/akBxEiFUjeJ5Zf
> XYLB9UH5SV4pD7VtjwfqGvI8zo8ym1UEyb91KYQyZzxmcv0iGwS2YZNlj4iPBKSY
> wTLQNDx3YcD66eLBSC2lnetDqeUJSSsuHmTEVVlF6uuoO0DECRkfqhQEsA9UQuv6
> AS7Qaab7+w2dc6As3qGvhtUZU8wVrUsBZmHwcJZxv5DbhxLj7I0KG4WDmfE9qvKe
> scsFkwyh9LKMTBetwXrgxkE8U5OavKa+ySpUllW6+5BVacipR7EQ0uG8CDQ5N3MD
> SozuoZ5lHWZoxNVK4Gg2
> =AmAp
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Sent from neither my iPhone nor my iPad.

Re: [URGENT] Content-Encoding: gzip not set

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Victor,

On 3/9/15 5:25 PM, Victor Rodriguez wrote:
> Thanks Mark!  Unfortunately, that is not an option.  The client
> will be requesting the files without the .gz extension.
> 
> On Mon, Mar 9, 2015 at 2:01 PM, Mark Thomas <ma...@apache.org>
> wrote:
> 
>> On 09/03/2015 19:12, Victor Rodriguez wrote:
>> 
>>> How do I tell Tomcat to include the Content-Encoding: gzip
>>> response header?  Again, these area ALREADY zipped files.  I'm
>>> not interested in Tomcat doing the gziping on the fly.
>> 
>> Add .gz to the end of the file name and set gzip="true" for the
>> default servlet.

If the client will be requesting the files without a .gz extension,
then ... you really ought to read the documentation for the feature
you are trying to use.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU/hHFAAoJEBzwKT+lPKRYIvUP/iXLC0HnWav5EdZlMG2KnlSs
MmVwikA7yoBLznMGcUSPNYhH8os6NKLusUltsxl8iWvGLCvxhNinNKSMShKOGby7
glXQ0o6Y0c2XCAiOCP0xv11RZNHjm+EZH1nrD8ZJoPegIrdxWXnO/P3Odx/3lNLn
PKt6M2TjEtzoBXy3V2QgXziOk/7ike5DHwZTi/NMIkV+e0OBrdqBgPlJPGMPngJU
5kmPQ7WSf3GlrkSw4ougIiKZAXqHHm27BlKkgO0pAn5qe78FcV0QCdfisLeXsU2o
frfuKAIpiVjsqmnSC9WHA8L4A2z2Pyma22thNjfZTRcCnyzXHsYDsfIafXed6V0N
oobXuXeOy/vtYEB6DulfJe6uxvfn5mD2YkTGNQjY4XbGuozlU/akBxEiFUjeJ5Zf
XYLB9UH5SV4pD7VtjwfqGvI8zo8ym1UEyb91KYQyZzxmcv0iGwS2YZNlj4iPBKSY
wTLQNDx3YcD66eLBSC2lnetDqeUJSSsuHmTEVVlF6uuoO0DECRkfqhQEsA9UQuv6
AS7Qaab7+w2dc6As3qGvhtUZU8wVrUsBZmHwcJZxv5DbhxLj7I0KG4WDmfE9qvKe
scsFkwyh9LKMTBetwXrgxkE8U5OavKa+ySpUllW6+5BVacipR7EQ0uG8CDQ5N3MD
SozuoZ5lHWZoxNVK4Gg2
=AmAp
-----END PGP SIGNATURE-----

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Mark Thomas <ma...@apache.org>.
On 09/03/2015 21:25, Victor Rodriguez wrote:
> Thanks Mark!  Unfortunately, that is not an option.  The client will be
> requesting the files without the .gz extension.

Who said anything about the client having to change the file name it was
requesting?

Did you even look at the documentation for the default servlet before
you rejected this option?

Mark



> 
> On Mon, Mar 9, 2015 at 2:01 PM, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 09/03/2015 19:12, Victor Rodriguez wrote:
>>
>>> How do I tell Tomcat to include the Content-Encoding: gzip response
>>> header?  Again, these area ALREADY zipped files.  I'm not interested in
>>> Tomcat doing the gziping on the fly.
>>
>> Add .gz to the end of the file name and set gzip="true" for the default
>> servlet.
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
Thanks Mark!  Unfortunately, that is not an option.  The client will be
requesting the files without the .gz extension.

On Mon, Mar 9, 2015 at 2:01 PM, Mark Thomas <ma...@apache.org> wrote:

> On 09/03/2015 19:12, Victor Rodriguez wrote:
>
> > How do I tell Tomcat to include the Content-Encoding: gzip response
> > header?  Again, these area ALREADY zipped files.  I'm not interested in
> > Tomcat doing the gziping on the fly.
>
> Add .gz to the end of the file name and set gzip="true" for the default
> servlet.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Sent from neither my iPhone nor my iPad.

Re: [URGENT] Content-Encoding: gzip not set

Posted by Mark Thomas <ma...@apache.org>.
On 09/03/2015 19:12, Victor Rodriguez wrote:

> How do I tell Tomcat to include the Content-Encoding: gzip response
> header?  Again, these area ALREADY zipped files.  I'm not interested in
> Tomcat doing the gziping on the fly.

Add .gz to the end of the file name and set gzip="true" for the default
servlet.

Mark


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Igor Cicimov <ic...@gmail.com>.
On 10/03/2015 9:13 AM, "Christopher Schultz" <ch...@christopherschultz.net>
wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Igor,
>
> On 3/9/15 6:01 PM, Igor Cicimov wrote:
> > On 10/03/2015 6:14 AM, "Victor Rodriguez" <vi...@gmail.com>
> > wrote:
> >>
> >> Greetings,
> >>
> >> I have some ALREADY gzipped files that I'm trying to serve up.
> >>
> >> I have the following in my web.xml.
> >>
> >> <mime-mapping> <extension>json</extension>
> >> <mime-type>application/gzip</mime-type> </mime-mapping>
> >>
> >>
> >> And, I have the following in my server.xml:
> >>
> >> <Context docBase="/path/to/already-gzipped-json"
> > path="/already-gzipped-json" />
> >>
> >>
> >> From the command line, I can curl the files and gunzip them just
> >> fine, so they are coming across gzipped:
> >>
> >> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip
> >> -
> >>
> >> However, requests coming from a web browser aren't handled
> >> correctly and aren't legible in the browser, and I believe it's
> >> because
> > Content-Encoding:
> >> gzip is not in the response headers.
> >>
> > You mean Accept-Encoding, right? Is tomcat fronted by apache, nginx
> > or something else that can add this header for you?
>
> Ironically, getting this to work as requested in Apache httpd is a
> complete nightmare. The Tomcat solution basically works *exactly* as a
> user would want it to work.
>
Thanks Chris, good to know before one starts going down this path!

> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJU/hqbAAoJEBzwKT+lPKRYEmsQAKc1Pm9c9ihQb5A1DDiRYAAN
> p0xj6JxxwjP2a1OawVUSXZU5umftkehDana6mLTPgZ/WtrzGxj8NR1ysl7or/eyC
> slrkLruzp716jkDL2ySZt7l2PsJScOwAC1j1ZsGJA0HyIIHz5AmON0Aff1ihdCGz
> uLXzDS2JyW7pdVFy6YLhfkCibocPv1NsXxo6NCbuTd91Rd2kwe7/KJ4YOLxXh2GX
> oorlctGc4NuiM0eFoj4xeNrEodIalYZvhi8YyPEDpnifuItY2q2yKCAhjZMYVZ+X
> A0WsQgGds5DWkeWPrR1dnGL82ZyoI1hN2vm6j5oWJnmSqzwuuUUdezmWOmXFWOhS
> pIuCW2zvLdP/MDblwsV7NMOopfoqHhTqoM+5p+ttQviCMGe8ubDd5Q/JLenzehEr
> lKdR78m812cuO84CZtKq0yIKF0Ipc1oYtXXKrHKkMbQWHbcvWTRvoqSNYICicXWF
> PmmpRFytUXywUqjj3e++mKRqHWUWkg2WuABocbTtwOTouL8tXop/v018PkUBDf37
> GqDzgVM0Y25O+jkxCj01ftDj+mrsDS5V8FH+sPtvt3DtgdWKTkIByNNeueau6zqh
> zSwB3FSBuWk9Six3DuwhTXHA/RX6kL3nnZX46Tv4RAT0wPkxFH2fKa/eD3IPTnng
> bWw+X47oId6UasMkj3pP
> =LKmV
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Re: [URGENT] Content-Encoding: gzip not set

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/10/2015 3:33 PM, Victor Rodriguez wrote:
> I'm sorry.  I should have prefaced my original question by stating
> that I'd read the Tomcat documentation and did extensive googling
> on the subject, but could not find the answer I was looking for.
> The only solution I found was having a servlet filter that adds the
> 'Content-encoding: gzip' response header and since I was
> referencing static content outside of any war file, I didn't want
> to have to write a servlet filter.
> 
> Underlying Chris's original response was the assumption that I
> hadn't already read the documentation or done some research on my
> own prior to asking for assistance here, which was not the case.
> And then he didn't even point me to the pertinent documentation,
> but rather just said that I should read the documentation.  If he
> had pointed me to the pertinent documentation, I would not have
> been upset, but simply telling me to read the documentation pissed
> me off a bit.
> 
> My apologies to all, but in the future, please don't assume that
> people haven't done some research prior to asking for assistance
> here.  Again, I accept part of the blame for not having said that
> to begin with, but telling someone to read the documentation
> without even so much as a hint as to where to look is analogous to
> telling someone to read the JDBC spec in response to a JDBC
> question (which by the way has also happened to me!) hehehe...
> 
> On Tue, Mar 10, 2015 at 4:09 PM, André Warnier <aw...@ice-sa.com>
> wrote:
> 
>> Victor Rodriguez wrote:
>> 
>>> I finally have it working in Apache using the following.  If
>>> there's an easy way to accomplish this in Tomcat I'd pref that
>>> cuz I could just leverage our existing deployed tomcats.
>>> Thanks!
>>> 
>>> AddType application/json .json AddType
>>> application/vnd.quantized-mesh .terrain AddEncoding x-gzip .gz
>>> .tgz .json .terrain
>>> 
>>> 
>> Victor, you are wasting everyone's time. Go away.
>> 
>> Or else, why do you not re-read the very first response to your
>> very first question, which already contained the correct answer,
>> more than 24 hours and 15 messages ago ?
>> 
>> Or are you so infused with yourself that you do not realise why
>> you might have upset some people here ?

Very, very late to the party. BIA/BCP/RTO/RPO/audit/yuck.

Victor,

Mark's answer was spot on, and the documentation for Tomcat 8.0 gives
more or less explicit instructions.

Skimming over the thread, I don't see where you ever told folks what
version of Tomcat you were using (I could be wrong).

Using Mark's answer, I immediately went to the following page:

http://tomcat.apache.org/tomcat-8.0-doc/default-servlet.html

Read that documentation, especially where it concerns gzip.

If you need an example as to how to set gzip=true, look at the other
init-param nodes in the web.xml included on that page.

Seriously, I know you don't want to hear this but read the
documentation. Yes it's sometimes a bit dense (as in lots of
information, few words). However, it is for the most part very fine
documentation. Where it's not, patches are welcome (yes, I have one
long overdue).

If you come back and say, "Here's what I read, here's what I
understood, here's what I tried, here's what happened, here's what I
wanted to happen", then people are much more likely to help. In short
(don't laugh, folks), demonstrate that you've put at least as much
effort into solving the problem as those people taking time to help
you find the answer.

Oh, and start out by reading this:

http://www.catb.org/esr/faqs/smart-questions.html

If not, then most likely you'll wear out your welcome.

It sounds like you have already worn out your welcome for JDBC.

. . . just my (beleaguered) 2 cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJU/3ySAAoJEEFGbsYNeTwtjNIIAJAODTPlhgLjiN6JgiGcNWVU
bhNVrWn3VdO+WmDsXxLFAt2Gux8zbno2UL16x2VnYymqtXFt5+GqaaBrCtLla0Mu
1kP1CKHr1NEfvGta3X4Tf1bOiS9VfMyystZh+rLrkw98qL5eQdfakKWtnMKpQgp1
ih+IwfZ1bozEE4F+18pM3nhJMtiuMiQsuFWMPLe0ieIDE22gF4mZHGZb6Z4QfMIs
JLElFLkHTTIY6zAz30ZrkOTx+OE3q4ULEpCsfplXQOogoraVgHMuzk0PGAYTNldV
9hkAvrqjXDhCCQ7Cnc2Z4NyUQ07vawWSmoR22jnSIBAgfsYHUj3gGmMoUOJAElE=
=t6am
-----END PGP SIGNATURE-----

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
Unfortunately, we're not ready to upgrade to 8.0.x yet, but I can see if I
can get our F5 load balancer to add the "Content-encoding: gzip" response
header.  Thanks guys!

Re: [URGENT] Content-Encoding: gzip not set

Posted by Mark Thomas <ma...@apache.org>.
On 11/03/2015 14:44, Victor Rodriguez wrote:
> Thanks Geoff!  The thing is that I'd rather not have to add a servlet
> filter.
> 
> Chris, I'm on Tomcat 7.0.53.

Finally. We have some version information.

The bad news is that the Default servlet gzip feature being discussed is
only available in 8.0.x.

>  The files don't have .gz extensions; they end
> in .json and .terrain.  If I have gzip="true" will tomcat add
> "Content-encoding: gzip" to all requests or only for files that end in
> .gz?

For those on Tomcat 8...

If the client requests foo.bar and declares that they accept gzip (and
gzip is enabled on the Default servlet), Tomcat looks for foo.bar.gz
and, if it exists, sets "Content-encoding: gzip" and returns the content
of foo.bar.gz.

In the unlikely event that the client doesn't support gzip or the more
likely event that a .gz version isn't available, Tomcat returns the
resource as originally requested. i.e. the idea is that both foo.bar and
foo.bar.gz exist in parallel.

> Having "Content-encoding: gzip" is the only way the browsers will
> gunzip on the fly.

Not strictly true although it requires a browser that actually follows
the HTTP specs for transfer-encoding and the last time I checked most
didn't.

> I was able to accomplish what I need with Apache with
> the following configuration, but my preference is to use Tomcat.

With Tomcat 7, a filter (which I know you'd rather not use - I mention
for others with the same question reading the archives) is likely the
simplest pure Tomcat option.

Another option would be to upgrade to 8.0.x.

Mark

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
Thanks Geoff!  The thing is that I'd rather not have to add a servlet
filter.

Chris, I'm on Tomcat 7.0.53.  The files don't have .gz extensions; they end
in .json and .terrain.  If I have gzip="true" will tomcat add
"Content-encoding: gzip" to all requests or only for files that end in
.gz?  Having "Content-encoding: gzip" is the only way the browsers will
gunzip on the fly.  I was able to accomplish what I need with Apache with
the following configuration, but my preference is to use Tomcat.

AddType application/json .json
AddType application/vnd.quantized-mesh .terrain
AddEncoding x-gzip .gz .tgz .json .terrain

Thanks!

Re: [URGENT] Content-Encoding: gzip not set

Posted by Geoff Meakin <sh...@gmail.com>.
Hi Victor,

I'm not sure if this is any use to you, but this guy seemed to have the
same issue as you:
http://stackoverflow.com/questions/1061066/http-compression-how-to-send-precompressed-files-that-exist-in-a-ear-file

Are you able to use the suggestion of an output filter to add the
content-encoding header for your already compressed files? It should work
if you can classify your precompressed files somehow - e.g. existing in a
directory or following a certain filename convention.

Hope that helps

Re: [URGENT] Content-Encoding: gzip not set

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Victor,

On 3/10/15 6:33 PM, Victor Rodriguez wrote:
> I'm sorry.

Don't apologize, just listen and respond appropriately.

> I should have prefaced my original question by stating that I'd 
> read the Tomcat documentation

Great. So, what is it about just setting gzip="true" on the
DefaultServlet that won't meet your needs?

> The only solution I found was having a servlet filter that adds
> the 'Content-encoding: gzip' response header

That shouldn't be necessary.

> and since I was referencing static content outside of any war
> file,

That's the first time you mentioned this requirement, although it's
easily solved. The solution depends upon your Tomcat version, which
you still haven't bothered to mention.

> I didn't want to have to write a servlet filter.

That shouldn't be necessary.

> Underlying Chris's original response was the assumption that I
> hadn't already read the documentation or done some research on my
> own prior to asking for assistance here, which was not the case.

If you read the docs, why didn't you say that you had read them? If
you had read them and understood them, you wouldn't have had to ask
the question that you did. Instead, you may have asked for
clarification before you actually tried configuring it.

http://www.catb.org/esr/faqs/smart-questions.html

> And then he didn't even point me to the pertinent documentation,
> but rather just said that I should read the documentation.  If he
> had pointed me to the pertinent documentation, I would not have
> been upset, but simply telling me to read the documentation pissed
> me off a bit.

The Tomcat documentation, while not the winner of any recent Pulitzer
Prizes, is definitely navigable: go to the Tomcat home page, and under
the "Documentation" menu, choose the version of Tomcat you are using.
There is even a top-level item for "default servlet" which Mark told
you to configure. Searching for "gzip" finds one relevant option. I
honestly don't understand why this is so hard.

And no, I'm generally not a jerk on this list. Had your tone been a
little more ... accommodating, I would have adjusted to that.

> telling someone to read the documentation without even so much as a
> hint as to where to look is analogous to telling someone to read
> the JDBC spec in response to a JDBC question (which by the way has
> also happened to me!)

That depends upon what the question was. If you asked what the return
type was for ResultSet.getString(String), I might tell you to go read
the spec, or at least the Javadoc.

This is a mailing list to support a community, not to be your own
personal reference librarian.

So, back to the original question: why doesn't gzip="true" meet your
needs? Your original muttering on the subject:

On 3/9/15 5:25 PM, Victor Rodriguez wrote:
> Thanks Mark!  Unfortunately, that is not an option.  The client
> will be requesting the files without the .gz extension.

either misunderstood the solution or you have some hidden requirement
that you aren't telling us.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVAEDBAAoJEBzwKT+lPKRYoc4P/iliA4J2eu1c61p6Z7NgSxl1
iocnme3HxkrE4z9h1Q0krHYFdiO1Z/CMWvsssibM/lKzG4luRZkOWKtMl49UiXW2
4zS2cZ0iwx1OtD/jSeTLc0hB6hoFdiiRCOG053ZNT7TyGLmarfuDs92j8YJbqLud
6l9Yggbk1T/zYRPoxzlarS/ZqPX7llDO3dUc0J4QmgSZHzXCHwnxCiUfW8NZutBG
kqp5g7u+PMh6ZIH2PfJ2oXsIaQmxY7gK9VrCwgqL0p6PJAqn8SxIcKucRjB6Ynb8
bp6Lj2eKwWvwwz/Pked+cWLVEXD45AxM1hJplJz45s/PBQdUkRMB9Yfh5R1lCTo/
qkJVwIyP4xl0VgBRE4TIxhoVQlFNKokZsrLIHcvJXe2W1puCLE3phQMtgPTEFf98
XXJ3q4XgBYsD6cFeD2iQlupbmp2j9GYQdPqrWgMzf7dTlYGEnOYQsG+CNIm1o+i6
7k9zDIcfRYdvkF0zMkGYx9RnkuAJFOYwdrt4VAzqxrLkjJcPJVs7k0Zo71FTBY4T
rAKWZlc4png0x5tE81gA+06Q69azFGd8SiAg03PvBXlmpw+3SJSgsOkAfq+PDt7o
/uwkCyxjH2069C3bVYP1buOReUKXrK4Q9wxy2OQVYWmgP9SIk2OIQuFAA8hvm0V3
H4Td0N+YzfKLMvBFmK9c
=N998
-----END PGP SIGNATURE-----

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
I'm sorry.  I should have prefaced my original question by stating that I'd
read the Tomcat documentation and did extensive googling on the subject,
but could not find the answer I was looking for.  The only solution I found
was having a servlet filter that adds the 'Content-encoding: gzip' response
header and since I was referencing static content outside of any war file,
I didn't want to have to write a servlet filter.

Underlying Chris's original response was the assumption that I hadn't
already read the documentation or done some research on my own prior to
asking for assistance here, which was not the case.  And then he didn't
even point me to the pertinent documentation, but rather just said that I
should read the documentation.  If he had pointed me to the pertinent
documentation, I would not have been upset, but simply telling me to read
the documentation pissed me off a bit.

My apologies to all, but in the future, please don't assume that people
haven't done some research prior to asking for assistance here.  Again, I
accept part of the blame for not having said that to begin with, but
telling someone to read the documentation without even so much as a hint as
to where to look is analogous to telling someone to read the JDBC spec in
response to a JDBC question (which by the way has also happened to me!)
 hehehe...

On Tue, Mar 10, 2015 at 4:09 PM, André Warnier <aw...@ice-sa.com> wrote:

> Victor Rodriguez wrote:
>
>> I finally have it working in Apache using the following.  If there's an
>> easy way to accomplish this in Tomcat I'd pref that cuz I could just
>> leverage our existing deployed tomcats.  Thanks!
>>
>> AddType application/json .json
>> AddType application/vnd.quantized-mesh .terrain
>> AddEncoding x-gzip .gz .tgz .json .terrain
>>
>>
> Victor, you are wasting everyone's time. Go away.
>
> Or else, why do you not re-read the very first response to your very first
> question, which already contained the correct answer, more than 24 hours
> and 15 messages ago ?
>
> Or are you so infused with yourself that you do not realise why you might
> have upset some people here ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Sent from neither my iPhone nor my iPad.

Re: [URGENT] Content-Encoding: gzip not set

Posted by André Warnier <aw...@ice-sa.com>.
Victor Rodriguez wrote:
> I finally have it working in Apache using the following.  If there's an
> easy way to accomplish this in Tomcat I'd pref that cuz I could just
> leverage our existing deployed tomcats.  Thanks!
> 
> AddType application/json .json
> AddType application/vnd.quantized-mesh .terrain
> AddEncoding x-gzip .gz .tgz .json .terrain
> 

Victor, you are wasting everyone's time. Go away.

Or else, why do you not re-read the very first response to your very first question, which 
already contained the correct answer, more than 24 hours and 15 messages ago ?

Or are you so infused with yourself that you do not realise why you might have upset some 
people here ?


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
I finally have it working in Apache using the following.  If there's an
easy way to accomplish this in Tomcat I'd pref that cuz I could just
leverage our existing deployed tomcats.  Thanks!

AddType application/json .json
AddType application/vnd.quantized-mesh .terrain
AddEncoding x-gzip .gz .tgz .json .terrain

On Tue, Mar 10, 2015 at 11:26 AM, Victor Rodriguez <vi...@gmail.com>
wrote:

>     AddType application/json .json
>     AddType application/vnd.quantized-mesh .terrain
>



-- 
Sent from neither my iPhone nor my iPad.

Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
    AddType application/json .json
    AddType application/vnd.quantized-mesh .terrain

Re: [URGENT] Content-Encoding: gzip not set

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Chris,

Am 10.03.2015 um 15:09 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Rainer,
>
> On 3/9/15 7:01 PM, Rainer Jung wrote:
>> Am 09.03.2015 um 23:11 schrieb Christopher Schultz:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>
>>> Igor,
>>>
>>> On 3/9/15 6:01 PM, Igor Cicimov wrote:
>>>> On 10/03/2015 6:14 AM, "Victor Rodriguez"
>>>> <vi...@gmail.com> wrote:
>>>>>
>>>>> Greetings,
>>>>>
>>>>> I have some ALREADY gzipped files that I'm trying to serve
>>>>> up.
>>>>>
>>>>> I have the following in my web.xml.
>>>>>
>>>>> <mime-mapping> <extension>json</extension>
>>>>> <mime-type>application/gzip</mime-type> </mime-mapping>
>>>>>
>>>>>
>>>>> And, I have the following in my server.xml:
>>>>>
>>>>> <Context docBase="/path/to/already-gzipped-json"
>>>> path="/already-gzipped-json" />
>>>>>
>>>>>
>>>>>  From the command line, I can curl the files and gunzip them
>>>>> just fine, so they are coming across gzipped:
>>>>>
>>>>> curl http://localhost:8082/already-gzipped-json/fie.json |
>>>>> gunzip -
>>>>>
>>>>> However, requests coming from a web browser aren't handled
>>>>> correctly and aren't legible in the browser, and I believe
>>>>> it's because
>>>> Content-Encoding:
>>>>> gzip is not in the response headers.
>>>>>
>>>> You mean Accept-Encoding, right? Is tomcat fronted by apache,
>>>> nginx or something else that can add this header for you?
>>>
>>> Ironically, getting this to work as requested in Apache httpd is
>>> a complete nightmare. The Tomcat solution basically works
>>> *exactly* as a user would want it to work.
>>
>> Agreed, that the feature in the default servlet is much much easier
>> to use than configure pre-compressed content in httpd. But
>> nightmare might be a bit to strong. It is tricky. See for example:
>>
>> http://mail-archives.apache.org/mod_mbox/httpd-users/201110.mbox/%3C4E8E51C0.4050708@kippdata.de%3E
>
> Would
>>
> you be up for the creation of mod_already_gzipped? It could act
> just like the DefaultServlet's behavior:
>
> 1. Did the client say it could Accept-Encoding: gzip?
> 2. Does the file [translated-path].gz exist?
> 3. Then send those bytes with Content-Encoding: gzip and
> Content-Length: size(file.gz)
>
> It seems like that should be a no-brainer in terms of functionality.
>
> Using MultiViews and re-naming your files to bizarre filenames, etc.
> is a big hack that I finally decided wasn't worth it.

Note that the linked recipe I provided for httpd does not use MultiViews 
and also does not force you to rename the existing (uncompressed) files.

It contains 5 lines of Apache config, of which 2 are most likely already 
present. So it boils down to one RewriteRule plus RewriteCond and one 
mod_headers directive. How and why it works is the long part of the 
description.

The only other thing is the maybe uncommon policy for the names of the 
*compressed* files, keeping the ".gz" in front of the original file name 
suffix. You could even move it completely in front of the file name like 
gz.myfile.suf to make it even more uncommon ;)

But yes, the recipe still needs to be adjusted depending on where your 
static files are, for which files you want to use it etc. So packing it 
into a simple module could be worthwhile. I'll post it if I get to it.

Regards,

Rainer

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Rainer,

On 3/9/15 7:01 PM, Rainer Jung wrote:
> Am 09.03.2015 um 23:11 schrieb Christopher Schultz:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> Igor,
>> 
>> On 3/9/15 6:01 PM, Igor Cicimov wrote:
>>> On 10/03/2015 6:14 AM, "Victor Rodriguez"
>>> <vi...@gmail.com> wrote:
>>>> 
>>>> Greetings,
>>>> 
>>>> I have some ALREADY gzipped files that I'm trying to serve
>>>> up.
>>>> 
>>>> I have the following in my web.xml.
>>>> 
>>>> <mime-mapping> <extension>json</extension> 
>>>> <mime-type>application/gzip</mime-type> </mime-mapping>
>>>> 
>>>> 
>>>> And, I have the following in my server.xml:
>>>> 
>>>> <Context docBase="/path/to/already-gzipped-json"
>>> path="/already-gzipped-json" />
>>>> 
>>>> 
>>>> From the command line, I can curl the files and gunzip them
>>>> just fine, so they are coming across gzipped:
>>>> 
>>>> curl http://localhost:8082/already-gzipped-json/fie.json |
>>>> gunzip -
>>>> 
>>>> However, requests coming from a web browser aren't handled 
>>>> correctly and aren't legible in the browser, and I believe
>>>> it's because
>>> Content-Encoding:
>>>> gzip is not in the response headers.
>>>> 
>>> You mean Accept-Encoding, right? Is tomcat fronted by apache,
>>> nginx or something else that can add this header for you?
>> 
>> Ironically, getting this to work as requested in Apache httpd is
>> a complete nightmare. The Tomcat solution basically works
>> *exactly* as a user would want it to work.
> 
> Agreed, that the feature in the default servlet is much much easier
> to use than configure pre-compressed content in httpd. But
> nightmare might be a bit to strong. It is tricky. See for example:
> 
> http://mail-archives.apache.org/mod_mbox/httpd-users/201110.mbox/%3C4E8E51C0.4050708@kippdata.de%3E

Would
> 
you be up for the creation of mod_already_gzipped? It could act
just like the DefaultServlet's behavior:

1. Did the client say it could Accept-Encoding: gzip?
2. Does the file [translated-path].gz exist?
3. Then send those bytes with Content-Encoding: gzip and
Content-Length: size(file.gz)

It seems like that should be a no-brainer in terms of functionality.

Using MultiViews and re-naming your files to bizarre filenames, etc.
is a big hack that I finally decided wasn't worth it.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU/vszAAoJEBzwKT+lPKRYEXIQAKLx1pbCojQ9kcAeCp/ChLOd
x0B9AB7vPJBnB7+BkQV9n+0ZDm8xSw1BqnIWkNFGlCm/5ysz1YTxi358o7ksIqXS
stJXzrnF03f9v2M8tkm5A0Tmb9zO5lPbfgcCnv2qjtYstVB4NyMtowo7sGtUGpVW
uYKRWiRBbjwK/np7esoi5waosPepMttPx1E6dVKqSOrru805qs8FzO+uEjlTfLOt
vClfbZm9bkpyNUiEaj1P/oc10vjzKMXAPL1aqu5RMJz8sxvZugT/nLIpUTFbBHLY
XJW+aaKzrV5mlb8OK3NvQTTFEZO+KhL1lqTrWVtiQUx9jIDed3fuzBhy8PggIIu7
IoD7nCL3sPASxm+Hf2cf2I64vEXZQg85sxZh8rEZTmruqqmGSx3EauDzReU7AVOW
C2PNRexath9p5Pv1d3gAMjapybx4xPNtbaA2ThSENurzsba2c4jdJXD7lMWmGaIf
lmBbmCaAIn2C0UWkPBAQKOSAKmE6jmpCkqwmhP7WhjALfOSUDVXJTRA7nZ0ZkMh1
UuypvPvqDDcyLKKnrSaQiyYQ09r92Ru393YqVtaaQRkNX3hKwciLYfd1saJnyo9b
x7z6xIgvNf/tGOWye/QW68rn3ahpmArizYNeSz/FxWZxXuuFuwJoyGhErrOAADdR
z2OK5VlnKZWPTbWUOqlV
=4c4D
-----END PGP SIGNATURE-----

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by André Warnier <aw...@ice-sa.com>.
Rainer Jung wrote:
> Am 09.03.2015 um 23:11 schrieb Christopher Schultz:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Igor,
>>
>> On 3/9/15 6:01 PM, Igor Cicimov wrote:
>>> On 10/03/2015 6:14 AM, "Victor Rodriguez" <vi...@gmail.com>
>>> wrote:
>>>>
>>>> Greetings,
>>>>
>>>> I have some ALREADY gzipped files that I'm trying to serve up.
>>>>
>>>> I have the following in my web.xml.
>>>>
>>>> <mime-mapping> <extension>json</extension>
>>>> <mime-type>application/gzip</mime-type> </mime-mapping>
>>>>
>>>>
>>>> And, I have the following in my server.xml:
>>>>
>>>> <Context docBase="/path/to/already-gzipped-json"
>>> path="/already-gzipped-json" />
>>>>
>>>>
>>>>  From the command line, I can curl the files and gunzip them just
>>>> fine, so they are coming across gzipped:
>>>>
>>>> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip
>>>> -
>>>>
>>>> However, requests coming from a web browser aren't handled
>>>> correctly and aren't legible in the browser, and I believe it's
>>>> because
>>> Content-Encoding:
>>>> gzip is not in the response headers.
>>>>
>>> You mean Accept-Encoding, right? Is tomcat fronted by apache, nginx
>>> or something else that can add this header for you?
>>
>> Ironically, getting this to work as requested in Apache httpd is a
>> complete nightmare. The Tomcat solution basically works *exactly* as a
>> user would want it to work.
> 
> Agreed, that the feature in the default servlet is much much easier to 
> use than configure pre-compressed content in httpd. But nightmare might 
> be a bit to strong. It is tricky. See for example:
> 
> http://mail-archives.apache.org/mod_mbox/httpd-users/201110.mbox/%3C4E8E51C0.4050708@kippdata.de%3E 
> 

I had been looking for something like that (in httpd) for quite a while. Thanks for the 
link (and also for the original full explanation).

André


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Rainer Jung <ra...@kippdata.de>.
Am 09.03.2015 um 23:11 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Igor,
>
> On 3/9/15 6:01 PM, Igor Cicimov wrote:
>> On 10/03/2015 6:14 AM, "Victor Rodriguez" <vi...@gmail.com>
>> wrote:
>>>
>>> Greetings,
>>>
>>> I have some ALREADY gzipped files that I'm trying to serve up.
>>>
>>> I have the following in my web.xml.
>>>
>>> <mime-mapping> <extension>json</extension>
>>> <mime-type>application/gzip</mime-type> </mime-mapping>
>>>
>>>
>>> And, I have the following in my server.xml:
>>>
>>> <Context docBase="/path/to/already-gzipped-json"
>> path="/already-gzipped-json" />
>>>
>>>
>>>  From the command line, I can curl the files and gunzip them just
>>> fine, so they are coming across gzipped:
>>>
>>> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip
>>> -
>>>
>>> However, requests coming from a web browser aren't handled
>>> correctly and aren't legible in the browser, and I believe it's
>>> because
>> Content-Encoding:
>>> gzip is not in the response headers.
>>>
>> You mean Accept-Encoding, right? Is tomcat fronted by apache, nginx
>> or something else that can add this header for you?
>
> Ironically, getting this to work as requested in Apache httpd is a
> complete nightmare. The Tomcat solution basically works *exactly* as a
> user would want it to work.

Agreed, that the feature in the default servlet is much much easier to 
use than configure pre-compressed content in httpd. But nightmare might 
be a bit to strong. It is tricky. See for example:

http://mail-archives.apache.org/mod_mbox/httpd-users/201110.mbox/%3C4E8E51C0.4050708@kippdata.de%3E

Regards,

Rainer


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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Igor,

On 3/9/15 6:01 PM, Igor Cicimov wrote:
> On 10/03/2015 6:14 AM, "Victor Rodriguez" <vi...@gmail.com>
> wrote:
>> 
>> Greetings,
>> 
>> I have some ALREADY gzipped files that I'm trying to serve up.
>> 
>> I have the following in my web.xml.
>> 
>> <mime-mapping> <extension>json</extension> 
>> <mime-type>application/gzip</mime-type> </mime-mapping>
>> 
>> 
>> And, I have the following in my server.xml:
>> 
>> <Context docBase="/path/to/already-gzipped-json"
> path="/already-gzipped-json" />
>> 
>> 
>> From the command line, I can curl the files and gunzip them just
>> fine, so they are coming across gzipped:
>> 
>> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip
>> -
>> 
>> However, requests coming from a web browser aren't handled
>> correctly and aren't legible in the browser, and I believe it's
>> because
> Content-Encoding:
>> gzip is not in the response headers.
>> 
> You mean Accept-Encoding, right? Is tomcat fronted by apache, nginx
> or something else that can add this header for you?

Ironically, getting this to work as requested in Apache httpd is a
complete nightmare. The Tomcat solution basically works *exactly* as a
user would want it to work.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJU/hqbAAoJEBzwKT+lPKRYEmsQAKc1Pm9c9ihQb5A1DDiRYAAN
p0xj6JxxwjP2a1OawVUSXZU5umftkehDana6mLTPgZ/WtrzGxj8NR1ysl7or/eyC
slrkLruzp716jkDL2ySZt7l2PsJScOwAC1j1ZsGJA0HyIIHz5AmON0Aff1ihdCGz
uLXzDS2JyW7pdVFy6YLhfkCibocPv1NsXxo6NCbuTd91Rd2kwe7/KJ4YOLxXh2GX
oorlctGc4NuiM0eFoj4xeNrEodIalYZvhi8YyPEDpnifuItY2q2yKCAhjZMYVZ+X
A0WsQgGds5DWkeWPrR1dnGL82ZyoI1hN2vm6j5oWJnmSqzwuuUUdezmWOmXFWOhS
pIuCW2zvLdP/MDblwsV7NMOopfoqHhTqoM+5p+ttQviCMGe8ubDd5Q/JLenzehEr
lKdR78m812cuO84CZtKq0yIKF0Ipc1oYtXXKrHKkMbQWHbcvWTRvoqSNYICicXWF
PmmpRFytUXywUqjj3e++mKRqHWUWkg2WuABocbTtwOTouL8tXop/v018PkUBDf37
GqDzgVM0Y25O+jkxCj01ftDj+mrsDS5V8FH+sPtvt3DtgdWKTkIByNNeueau6zqh
zSwB3FSBuWk9Six3DuwhTXHA/RX6kL3nnZX46Tv4RAT0wPkxFH2fKa/eD3IPTnng
bWw+X47oId6UasMkj3pP
=LKmV
-----END PGP SIGNATURE-----

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


Re: [URGENT] Content-Encoding: gzip not set

Posted by Victor Rodriguez <vi...@gmail.com>.
Interesting, we don't front with Apache, but we do have an F5 load
balancer.  Maybe it can add the "Content-encoding; gzip' response header.
Thanks for the idea!  In the meantime, I'll keep plugging away trying to
get Tomcat to do it correctly.  thanks again!

On Mon, Mar 9, 2015 at 4:01 PM, Igor Cicimov <ic...@gmail.com> wrote:

> On 10/03/2015 6:14 AM, "Victor Rodriguez" <vi...@gmail.com> wrote:
> >
> > Greetings,
> >
> > I have some ALREADY gzipped files that I'm trying to serve up.
> >
> > I have the following in my web.xml.
> >
> > <mime-mapping>
> >     <extension>json</extension>
> >     <mime-type>application/gzip</mime-type>
> > </mime-mapping>
> >
> >
> > And, I have the following in my server.xml:
> >
> > <Context docBase="/path/to/already-gzipped-json"
> path="/already-gzipped-json" />
> >
> >
> > From the command line, I can curl the files and gunzip them just fine, so
> > they are coming across gzipped:
> >
> > curl http://localhost:8082/already-gzipped-json/fie.json | gunzip -
> >
> > However, requests coming from a web browser aren't handled correctly and
> > aren't legible in the browser, and I believe it's because
> Content-Encoding:
> > gzip is not in the response headers.
> >
> You mean Accept-Encoding, right? Is tomcat fronted by apache, nginx or
> sometning else that can add this header for you? If not then maybe just
> consider it as option if you can't solve it in tomcat although according to
> the comments you got here from people that are really experts it should be
> possible.
>
> > curl -I http://localhost:8082/already-gzipped-json/fie.json
> >
> > HTTP/1.1 200 OK
> > Server: Apache-Coyote/1.1
> > Accept-Ranges: bytes
> > Last-Modified: Mon, 09 Mar 2015 17:15:29 GMT
> > Content-Type: application/gzip
> > Content-Length: 17905
> > Date: Mon, 09 Mar 2015 19:11:06 GMT
> >
> > How do I tell Tomcat to include the Content-Encoding: gzip response
> > header?  Again, these area ALREADY zipped files.  I'm not interested in
> > Tomcat doing the gziping on the fly.
> >
> > Thanks!
> > --
> > Sent from neither my iPhone nor my iPad.
>



-- 
Sent from neither my iPhone nor my iPad.

Re: [URGENT] Content-Encoding: gzip not set

Posted by Igor Cicimov <ic...@gmail.com>.
On 10/03/2015 6:14 AM, "Victor Rodriguez" <vi...@gmail.com> wrote:
>
> Greetings,
>
> I have some ALREADY gzipped files that I'm trying to serve up.
>
> I have the following in my web.xml.
>
> <mime-mapping>
>     <extension>json</extension>
>     <mime-type>application/gzip</mime-type>
> </mime-mapping>
>
>
> And, I have the following in my server.xml:
>
> <Context docBase="/path/to/already-gzipped-json"
path="/already-gzipped-json" />
>
>
> From the command line, I can curl the files and gunzip them just fine, so
> they are coming across gzipped:
>
> curl http://localhost:8082/already-gzipped-json/fie.json | gunzip -
>
> However, requests coming from a web browser aren't handled correctly and
> aren't legible in the browser, and I believe it's because
Content-Encoding:
> gzip is not in the response headers.
>
You mean Accept-Encoding, right? Is tomcat fronted by apache, nginx or
sometning else that can add this header for you? If not then maybe just
consider it as option if you can't solve it in tomcat although according to
the comments you got here from people that are really experts it should be
possible.

> curl -I http://localhost:8082/already-gzipped-json/fie.json
>
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Accept-Ranges: bytes
> Last-Modified: Mon, 09 Mar 2015 17:15:29 GMT
> Content-Type: application/gzip
> Content-Length: 17905
> Date: Mon, 09 Mar 2015 19:11:06 GMT
>
> How do I tell Tomcat to include the Content-Encoding: gzip response
> header?  Again, these area ALREADY zipped files.  I'm not interested in
> Tomcat doing the gziping on the fly.
>
> Thanks!
> --
> Sent from neither my iPhone nor my iPad.