| <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html lang="en-us" xml:lang="en-us"> |
| <head> |
| <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
| <meta name="copyright" content="Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" /> |
| <meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" /> |
| <meta content="public" name="security" /> |
| <meta content="index,follow" name="Robots" /> |
| <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> |
| <meta content="concept" name="DC.Type" /> |
| <meta name="DC.Title" content="Listeners" /> |
| <meta content="filters, overview" name="DC.subject" /> |
| <meta content="filters, overview" name="keywords" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/cwservbn.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/cwlistbn.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/ccwtover.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/twsrvwiz.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/twlstwiz.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/twfltwiz.html" /> |
| <meta content="XHTML" name="DC.Format" /> |
| <meta content="cwfiltbn" name="DC.Identifier" /> |
| <meta content="en-us" name="DC.Language" /> |
| <link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" /> |
| <title>Listeners</title> |
| </head> |
| <body id="cwfiltbn"><a name="cwfiltbn"><!-- --></a> |
| |
| |
| <h1 class="topictitle1">Listeners</h1> |
| |
| |
| <div> |
| <p>Filters are new in the <cite>Sun Microsystems Java Servlet |
| 2.3 Specification</cite>. 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.</p> |
| |
| <p>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.</p> |
| |
| <p>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.</p> |
| |
| <div class="p">When writing a filter, you basically deal with the |
| following three interfaces in the javax.servlet package: |
| <ul> |
| <li><strong>javax.servlet.Filter:</strong> represents the |
| life-cycle of the filter.</li> |
| |
| <li><strong>javax.servlet.FilterConfig:</strong> represents the |
| configuration of the filter.</li> |
| |
| <li><strong>javax.servlet.FilterChain:</strong> object provided by |
| the servlet container to the developer giving a view into the |
| invocation chain of a filtered request for a resource.</li> |
| |
| </ul> |
| </div> |
| |
| <p>For more information about filters, refer to the <cite>Sun Microsystems Java™ Servlet |
| 2.3 Specification</cite> at <samp class="codeph">java.sun.com/products/servlet/download.html</samp>.</p> |
| |
| </div> |
| |
| <div><div class="relconcepts"><strong>Related concepts</strong><br /> |
| <div><a href="../topics/cwservbn.html" title="">Servlets</a></div> |
| <div><a href="../topics/cwlistbn.html" title="">Listeners</a></div> |
| <div><a href="../topics/ccwtover.html" title="">Web application overview</a></div> |
| </div> |
| <div class="reltasks"><strong>Related tasks</strong><br /> |
| <div><a href="../topics/twsrvwiz.html">Creating Servlets</a></div> |
| <div><a href="../topics/twlstwiz.html">Creating Listeners</a></div> |
| <div><a href="../topics/twfltwiz.html">Creating Filters</a></div> |
| </div> |
| </div> |
| |
| </body> |
| </html> |