I read everytime Filters are like servlets. Resin is a servlet container. Is there exist any filter container to initialize filters or does it take the role in servlet container only. Can anybody elaborate how it works?
views:
63answers:
3
                +4 
                A: 
                
                
              - Servlets are components that handle an HTTP request/response cycle
- Filters are components that intercept HTTP requests and response before/after they reach the target servlet
- Servlet containers make sure the two points above work - i.e. they instantiate servlets and filters and "give" them the requests/responses
                  Bozho
                   2010-01-06 18:16:14
                
              +1, Concise yet covers all the points clearly.
                  Andrzej Doyle
                   2010-01-06 18:18:38
                And Filters are *part* of Servlet API. Note the package name http://java.sun.com/javaee/6/docs/api/javax/servlet/Filter.html
                  BalusC
                   2010-01-06 18:19:35
                
                
                A: 
                
                
              
            Java Servlet Filters allow you to "layer on" additional behavior in front of a Servlet, JSP page, or even static resources like css, js, and image files.
The classic example of Filter use is Authorization: checking to ensure the user is authorized to view the specified resource.
Some observations:
- A Filter can do work before the specified resource (servlet, etc.), after, or both
- Multiple Filters may be applied to the same resource
                  Drew Wills
                   2010-01-06 18:20:36
                
              
                +1 
                A: 
                
                
              
            There is nothing like Filter container, it is included in servlet container.
                  fastcodejava
                   2010-01-06 18:21:39