• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat's CompressionFilter + ExampleFilter code

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

Where can I find the code for these filters on the web???

Have searched googgle but no help.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joseph Sweet:
Have searched googgle but no help.


You couldn't have searched for long.


http://www.google.com/search?hl=en&q=SERVLET+FILTER+TUTORIAL+GZIP&btnG=Google+Search
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to help.

You do know that Tomcat has built in compression capabilities, right?
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you again.

I did not know of that.
I will have to read that refernce.
It is good to know.
:roll:

Actually, I am trying to understand filters, and wanted to see the code they wer eusing in some articles.
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is actually a stream? Particularly a ServletOutputStream?


In the GZIPResponseWrapper extends HttpServletResponseWrapper, there is:







Why do I have to define (override) that method? Why do they have a problem if the writer was initialized?






Okay PrintWriter I know. that's the class that lets me write the servlet's output to the HttpServletResponse.

Why does it have a problem if the stream is already initialized?

Also, if HttpServletResponse is an interface, how can we define an instance of it???
[ April 27, 2005: Message edited by: Joseph Sweet ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to consider starting a new thread in the servlets forum as this one attracts mostly people interested in configuring and debugging Tomcat..



Okay PrintWriter I know. that's the class that lets me write the servlet's output to the HttpServletResponse.
Why does it have a problem if the stream is already initialized?
Picture a servlet trying to return 2 streams OR
picture two pieces of code trying to write to the same stream.
That codes insures that there is only one and that it's clean.


Also, if HttpServletResponse is an interface, how can we define an instance of it???
The javax.servlet.http package provides the HttpServletResponseWrapper which you can extend and then, override whatever methods you need to in order to accomplish your goals.
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletResponseWrapper.html
[ April 27, 2005: Message edited by: Ben Souther ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic