I am having trouble in returning compressed response (GZip) from my Java Servlet, to a JSP.
Flow :
- Request comes to java servlet
- Process the request, and create a JSON object, with the response
- Convert the JSON object to string
- Compress the response string with GZip
- The compressed response string is set as attribute in the request object and control passed to JSP
- In the JSP, the response string (compressed) is printed on screen
Precautions :
- Request object has "Accepting-Encoding" set with "gzip"
- Response header has "Content-Encoding" set to "gzip"
- Response content type is set to "application/json"
- Response character encoding is set to "ISO-8859-1"
Result :
- Firefox shows "Content Encoding Error"
- Chrome shows "Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error."
Can anyone help point me out, in the right direction please?