Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Web Tools Guide
Previous Page Home Next Page

Listeners

Filters are new in the Sun Microsystems Java Servlet 2.3 Specification. They enable you to intercept to intercept a request before it reaches a resource. In other words, a filter gives you access to the HttpServletRequest and the HttpServletResponse objects before they are passed on to a servlet.

Filters can be very useful. For example, you can write a filter that records all incoming requests and logs the IP addresses of the computers from which the requests originate. You also can use a filter as an encryption and decryption device. Other uses include user authentication, data compression, user input validation, and so on.

You also can put a set of filters in a chain. The first filter in the chain will be called first and then pass control to the second filter, and so on. Filter chaining ensures that you can write a filter that does a specific task but adds some functionality in another filter.

When writing a filter, you basically deal with the following three interfaces in the javax.servlet package:
  • javax.servlet.Filter: represents the life-cycle of the filter.
  • javax.servlet.FilterConfig: represents the configuration of the filter.
  • javax.servlet.FilterChain: object provided by the servlet container to the developer giving a view into the invocation chain of a filtered request for a resource.

For more information about filters, refer to the Sun Microsystems Java™ Servlet 2.3 Specification at java.sun.com/products/servlet/download.html.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire