• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compression Filter

 
Kamal Nassili
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new to javaranch and i would thank all the members who are in here
because this place was very helpful to me in my preparation of SCWCD.

Once more I ask for help on this problem:

I downloaded the source code of CompressionFilter sample of the book HFServlet&Jsp (i got it from HeadFirstlabs.com), i used it but NO OUTPUT is shown in the browser. but when i comment the line: "//wrappedResp.setHeader("Content-Encoding", "gzip"); " the output is: "{???" (some thing like that).
what is wrong ?
thanks.
 
Kamal Nassili
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hope the ranchers forgive me if i make some mistakes or misanderstanding in my posts, because English isn't my first language.
thank you very much for your comprehension!
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CompressionFilter example in HFSJ compresses the output in GZIP format using GZipStream before sending to the client and the browser will understand the output with the header: Content-Encoding and if not set it defaults to text/html. So if you comment the line then the browser will not be able to understand and decompress it back to text from gzip and will show invalid characters. With wrappedResp.setHeader("Content-Encoding", "gzip"); you tell the browser throgh Http response header that the content that you are about to receive is in gzip format. The browser will no encode it into Text and display it.

Hope am correct and your doubt is cleared
 
Kamal Nassili
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks to take time to reply, but that doesn't clear my problem...I still have blank output on the browser if the line is UNcommented...
Though i did n't make any changes to the source code (downloaded from HFlabs.com)still it doesn't work (no output at all).

Does anyone had the same problem ?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd use a tool like the LiveHTTPHeaders extension for Firefox to study exactly what is being sent, and what is being received.
[ November 14, 2008: Message edited by: Ulf Dittmer ]
 
Kamal Nassili
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'll try to get it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic