Java - What is Servlet Filter and how does it
work? - March 16, 2010 at 15:05 PM by Vidya Sagar
What is Servlet Filter and how does it work?
Filters are powerful tools in servlet environment. Filters add certain
functionality to the servlets apart from processing request and response
paradigm of servlet processing. Filters manipulate the request and response in
a web application, and they can be applied to any resources like HTML,
graphics, a JSP page which are served by the servlet engine. Authentication of
data, format conversion of data and redirecting the page to another page are
certain useful functions of filters.
A filter is configured in a web.xml file. The class using the filters should
extend javax.servlet.Filter. Every request in a web application, the servlet
container decides the filters to apply and adds them to the filter chain, in
the order they appear in web.xml file. A filter also has life cycle mechanisms
init(),doFilter() and destroy().
Test your Java skills
part 1 (39 questions)
Java part 2 (40 questions)
EJB (20 questions)
JDBC (20 questions)
Applet (20 questions)
Struts (21 questions)
Servlets (20 questions)
Java web services (20 questions)
Preemptive scheduling enables the highest priority task execution until waiting
or dead states entered. It also executes, until a higher priority task
DatabaseMetaData provides comprehensive information about the database. This
interface is implemented by the driver vendors to allow the user to obtain
information about the tables of a relational database as a part of JDBC
Java Isolates is an API. It provides a mechanism to manage Java application
life cycles which are isolated from each other. They can potentially share the
underlying implementation resources............