Source Code Cross Referenced for Filter.java in  » 6.0-JDK-Core » Servlet-API-by-tomcat » javax » servlet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Servlet API by tomcat » javax.servlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01        /*
02         * Copyright 2004 The Apache Software Foundation
03         *
04         * Licensed under the Apache License, Version 2.0 (the "License");
05         * you may not use this file except in compliance with the License.
06         * You may obtain a copy of the License at
07         *
08         *     http://www.apache.org/licenses/LICENSE-2.0
09         *
10         * Unless required by applicable law or agreed to in writing, software
11         * distributed under the License is distributed on an "AS IS" BASIS,
12         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13         * See the License for the specific language governing permissions and
14         * limitations under the License.
15         */
16        package javax.servlet;
17
18        import java.io.IOException;
19
20        /** 
21         * A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both.
22         * <br><br>
23         * Filters perform filtering in the <code>doFilter</code> method. Every Filter has access to 
24         ** a FilterConfig object from which it can obtain its initialization parameters, a
25         ** reference to the ServletContext which it can use, for example, to load resources
26         ** needed for filtering tasks.
27         ** <p>
28         ** Filters are configured in the deployment descriptor of a web application
29         ** <p>
30         ** Examples that have been identified for this design are<br>
31         ** 1) Authentication Filters <br>
32         ** 2) Logging and Auditing Filters <br>
33         ** 3) Image conversion Filters <br>
34         ** 4) Data compression Filters <br>
35         ** 5) Encryption Filters <br>
36         ** 6) Tokenizing Filters <br>
37         ** 7) Filters that trigger resource access events <br>
38         ** 8) XSL/T filters <br>
39         ** 9) Mime-type chain Filter <br>
40         * @since	Servlet 2.3
41         */
42
43        public interface Filter {
44
45            /** 
46             * Called by the web container to indicate to a filter that it is being placed into
47             * service. The servlet container calls the init method exactly once after instantiating the
48             * filter. The init method must complete successfully before the filter is asked to do any
49             * filtering work. <br><br>
50
51             * The web container cannot place the filter into service if the init method either<br>
52             * 1.Throws a ServletException <br>
53             * 2.Does not return within a time period defined by the web container 
54             */
55            public void init(FilterConfig filterConfig) throws ServletException;
56
57            /**
58             * The <code>doFilter</code> method of the Filter is called by the container
59             * each time a request/response pair is passed through the chain due
60             * to a client request for a resource at the end of the chain. The FilterChain passed in to this
61             * method allows the Filter to pass on the request and response to the next entity in the
62             * chain.<p>
63             * A typical implementation of this method would follow the following pattern:- <br>
64             * 1. Examine the request<br>
65             * 2. Optionally wrap the request object with a custom implementation to
66             * filter content or headers for input filtering <br>
67             * 3. Optionally wrap the response object with a custom implementation to
68             * filter content or headers for output filtering <br>
69             * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>   
70             ** 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter chain to block the request processing<br>
71             ** 5. Directly set headers on the response after invocation of the next entity in the filter chain.
72             **/
73            public void doFilter(ServletRequest request,
74                    ServletResponse response, FilterChain chain)
75                    throws IOException, ServletException;
76
77            /**
78             * Called by the web container to indicate to a filter that it is being taken out of service. This 
79             * method is only called once all threads within the filter's doFilter method have exited or after
80             * a timeout period has passed. After the web container calls this method, it will not call the
81             * doFilter method again on this instance of the filter. <br><br>
82             * 
83             * This method gives the filter an opportunity to clean up any resources that are being held (for
84             * example, memory, file handles, threads) and make sure that any persistent state is synchronized
85             * with the filter's current state in memory.
86             */
87
88            public void destroy();
89
90        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.