cancel
Showing results for 
Search instead for 
Did you mean: 

How to turn off gzip compression for specific Servlet responses.

jochen_wilhelm
Explorer
0 Kudos

Hi all,

i got the problem that on our J2EE 6.40 installation all response content seems to be automatically compressed via gzip (if the request has the header "Accept-Encoding: gzip", of course).

But i need a uncompressed/unencoded repsonse.

Therefore I tried to override the HTTP header of my servlet- response with:

response.setHeader("Content-Encoding","none");

But this result in the following http-header of the corresponding servlet response.

.....

Content-Encoding: none

Content-Encoding: gzip

.....

It seems to me that the J2EE automatically compresses responses.

Unfortunately i am not able to set the "Accept-Encoding" header of the corresponding request which initiate this response. This is related to an IE bug with XMLHttpRequest which i must use for my program.

Thank you very much for any hint.

Kind regards

Jochen

Accepted Solutions (1)

Accepted Solutions (1)

viliana
Advisor
Advisor
0 Kudos
jochen_wilhelm
Explorer
0 Kudos

Hi Viliana,

thank you very much for this very quick answer and this great hint. This really solved my problem.

Thank you very much!

Best regards

Jochen

Answers (2)

Answers (2)

Former Member
0 Kudos

How to make the same steps in NW CE 7.1, since Visual admin is not available with this version, instead nwa is available.

detlev_beutner
Active Contributor
0 Kudos

Hi Jochen,

first, welcome on SDN! About your question:

I'm not sure if this is possible by a programming approach, as you showed that Content-Encoding: gzip seems to be added automatically.

This probably is done by the server settings. You can en-/disable compression, also for specific content types, via VisualAdministrator:

Server -> Services -> http -> Properties -> Compression

Hope it helps

Detlev

PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!

jochen_wilhelm
Explorer
0 Kudos

Hi Detlev,

thank you for your quick hint and the nice welcome message

Best regards.

Jochen