----- Original Message -----
From: "Bo Xu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>

>   if I want to define more than one filter-declarations, but I want to map
>    them to the same "url-pattern", for example:
>
> <filter>
>   <filter-name> filter0 </filter-name>
>   <filter-class> MyFilter0 </filter-class>
> </filter>
> <filter-mapping>
>   <filter-name>filter0</filter-name>
>   <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> <filter>
>   <filter-name> filter1 </filter-name>
>   <filter-class> MyFilter1 </filter-class>
> </filter>
> <filter-mapping>
>   <filter-name>filter1</filter-name>
>   <url-pattern>/*</url-pattern>
> </filter-mapping>
>
> - is the above correct?


Seems ok to me.

> - does "FilterChain" mean that I can define one or more than one filters?

yes. The spec say the functionality available includes "Actions on a
servlet, on groups of servlets or static content by zero, one or
more filters in a specifiable order."


>    and container will use them one by one?

The responsibility is on both the code in the filter and the container.
The specs say

"The invocation of the next entity is effected by calling the doFilter()
method on the FilterChain object, passing in the request and response it
was called with, or wrapped versions it may have created.
The filter chain's implementation of the doFilter method, as provided by
the container, must locate the next entity in the filter chain and invoke
its
doFilter method, passing in the request and response objects with which it
was invoked."


> - if I want filter0 should be "used" first, then filter1, how can I set
the
>    "order"?

The order is invocation is defined by the specs as

"The order in which the container builds the chain of filters to be applied
for a
particular request URI is
1. The URL pattern matching filter-mappings in the same order that those
elements
appear in the deployment descriptor, and then
2. The servlet-name matching filter-mappings in the same order that those
elements
appear in the deployment descriptor.  "


Regds,
Gokul

>
> Bo
> June 15, 2001

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to