• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

filters query

 
yeshwanth reddy
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

For the filter mapping,

<filter-mapping>
<filter-name>BeerRequest</filter-name>
<servlet-name>********</servlet-name>
</filter-mapping>


What should we enter in ********* .Is it the name of the servlet or is it the path to the servlet.

Regards,
Yashwanth
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !

You have two possibilities for filter mapping.

You can use either a servlet-name element OR a url-pattern element.

The servlet-name element should receive the name of one of the servlet defined in the DD (as defined in the <servlet-name> element of the <servlet> block).

The url-pattern is used to define a pattern, exactly the same way you do for servlet-mapping.

One of these two must be used, but only one (this changes in J2EE 1.5, where you can use multiple url-pattern/servlet-name elements at the same time).

Warning : the element choice (servlet-name or url-pattern) has an effect on the filter order in the chain.

First, url-pattern defined filters are put in the FilterChain in the order of their declaration in the DD.

Then, the servlet-name defined filters are put in the FilterChain, in the order of their declaration in the DD.

Hope this helps.
[ March 19, 2006: Message edited by: Frederic Esnault ]
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What should we enter in ********* .Is it the name of the servlet or


name of the servlet. As per the tag name(servlet-name). Implied


is it the path to the servlet.


For path we use <url-pattern>
 
yeshwanth reddy
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If servlet-name in the filters is the name of the servlet as given in the <servlet-name> of <servlet> , why is it given in the form of a relative url in hfsj? servlets name in <servlet> tag is not in the format of /something/...

Regards,
Yashwanth
 
Frederic Esnault
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw what you mean, at page 680 of HFSJ, the servlet-name element is used as a url-pattern element. It must be an error.
 
yeshwanth reddy
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, you are right fredrick, its on page 680...it should be an error.

Regards,
Yashwanth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic