You are viewing a plain text version of this content. The canonical link for it is here.
Posted to servletapi-dev@jakarta.apache.org by da...@locus.apache.org on 2000/10/20 03:20:56 UTC
cvs commit: jakarta-servletapi/src/share/javax/servlet FilterChain.java Filter.java FilterConfig.java
dannyc 00/10/19 18:20:55
Modified: src/share/javax/servlet Tag: SERVLET_23_JSP_12 Filter.java
FilterConfig.java
Added: src/share/javax/servlet Tag: SERVLET_23_JSP_12
FilterChain.java
Log:
Update with agreed modifications to Filter API and javadoc terminology
Revision Changes Path
No revision
No revision
1.1.2.3 +20 -12 jakarta-servletapi/src/share/javax/servlet/Attic/Filter.java
Index: Filter.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi/src/share/javax/servlet/Attic/Filter.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Filter.java 2000/10/19 01:47:57 1.1.2.2
+++ Filter.java 2000/10/20 01:20:54 1.1.2.3
@@ -66,10 +66,13 @@
** A filter is an object than perform filtering tasks
** on either the request to a servlet, or on the response from
** a servlet, or both.<br><br>
- ** Filters do their filtering in the doFilter method. Every Filter has access to
+ ** Filters perform filtering in the <code>doFilter</code> method. Every Filter has access to
** a FilterConfig object from which it can obtain its initialization parameters, a
- ** reference to the ServletContext and a view into the Filter stack.
+ ** reference to the ServletContext which it can use, for example, to load resources
+ ** needed for filtering tasks.
** <p>
+ ** Filters are configured in the deployment descriptor of a web application
+ ** <p>
** Examples that have been identified for this design are<br>
** 1) Authentication Filters <br>
** 2) Logging and Auditing Filters <br>
@@ -85,31 +88,36 @@
public interface Filter {
- /** The container calls this method when the Filter is instantiated and
+ /**
+ * The container calls this method when the Filter is instantiated and
** passes in a FilterConfig object. When the container is done with
** the Filter, it calls this method, passing in null.
*/
public void setFilterConfig(FilterConfig filterConfig);
- /** Return the FilterConfig for this Filter.
+
+ /**
+ * Return the FilterConfig for this Filter.
+ *
*/
public FilterConfig getFilterConfig();
/**
- * The doFilter method of the Filter is called by the container
- * each time a request/response pair is passed through the stack due
- * to a client request for the Servlet in the stack.
+ * The <code>doFilter</code> method of the Filter is called by the container
+ * each time a request/response pair is passed through the chain due
+ * to a client request for the Servlet at the end of the chain. The FilterChain passed in to this
+ * method allows the Filter to pass on the request and response to the next entity in the
+ * chain.<p>
* A typical implementation of this method would follow the following pattern:- <br>
* 1. Examine the request<br>
* 2. Optionally wrap the request object with a custom implementation to
* filter content or headers for input filtering <br>
* 3. Optionally wrap the response object with a custom implementation to
* filter content or headers for output filtering <br>
- * 4. a) <strong>Either</strong> invoke the next entity in the stack using the getFilterConfig().getNext() call
- ** to obtain the next Filter and calling doFilter(), <br>
- ** 4. b) <strong>or</strong> not pass on the request/response pair to the next entity in the filter stack<br>
- ** 5. Directly set headers on the response after invokation of the next Filter
+ * 4. a) <strong>Either</strong> invoke the next entity in the chain using the FilterChain object (<code>chain.doFilter()</code>), <br>
+ ** 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>
+ ** 5. Directly set headers on the response after invokation of the next entity in ther filter chain.
**/
- public void doFilter ( ServletRequest request, ServletResponse response ) throws IOException, ServletException;
+ public void doFilter ( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException;
}
1.1.2.3 +2 -20 jakarta-servletapi/src/share/javax/servlet/Attic/FilterConfig.java
Index: FilterConfig.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi/src/share/javax/servlet/Attic/FilterConfig.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- FilterConfig.java 2000/10/16 19:09:05 1.1.2.2
+++ FilterConfig.java 2000/10/20 01:20:54 1.1.2.3
@@ -68,14 +68,9 @@
/**
*
* A filter configuration object used by a servlet container
- * used to pass information to a filter during initialization.<p>
- * As well as holding the initialization parameters of a Filter, the FilterConfig provides a view into
- * the next Filter and also of the remaining remaining Filters in the Filter stack of a Servlet. The last object in the Filter
- * stack is always the Servlet that is being filtered. Containers provide a wrapper implementation
- * of the Filter interface to wrap the Servlet so that Filters never know whether the next object
- * in the stack is another Filter or the Servlet that it is filtering.
+ * used to pass information to a filter during initialization.
* @see Filter
- * @since v 2.3
+ * @since Servlet 2.3
*
*/
@@ -88,19 +83,6 @@
public String getFilterName();
- /**
- * Returns the next Filter object in the filter stack.
- */
- public Filter getNext ();
-
- /**
- * Returns the remaining Filter objects in the Filter stack in the order
- * that they have been configured. The purpose
- * of this method it to allow Filters to decide to skip remaining
- * filters in the stack if they wish. The Iterator returned does not
- * support the optional remove() operation.
- **/
- public Iterator getFilters();
/**
* Returns a reference to the {@link ServletContext} in which the caller
No revision
No revision
1.1.2.1 +90 -0 jakarta-servletapi/src/share/javax/servlet/Attic/FilterChain.java