Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

servlet-name

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks,

Am a bit confused. If <servlet-name> appears under <servlet>, it is like a DD internal servlet name and if it appears inside <filter-mapping>, it is treated like <url-pattern>. Am I correct?

Thanks
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each servlet-name is unique, and used to identify a servlet.
If you decide to put a filter to a particular servlet,
you can specify its name in the <servlet-name> of <filter-mapping>.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer to the specs. There is no other better substitute.

Servlet 2.4 specs (pdf), SRV.6.2.3 Page 53.
You can download it here.
 
Vin Ram
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did look up the spec and am still confused. Please see below ...

<servlet>
<servlet-name>MyServlet<servlet-name> --> (1)
<servlet-class>com.testservlet<servlet-class>
<servlet>
<servlet-mapping>
<servlet-name>MyServlet<servlet-name> --> (1)
<url-pattern>/foo/bar<url-pattern>
<servlet-mapping>

<filter-mapping>
<filter-name>MyFilter</filter-name>
<servlet-name>MyServlet</servlet-name> --> (2)
</filter-mapping>


Is 2 related to 1 in anyway? Or is (2) treated like a url pattern for the filter? Thanks
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your original question as to <servlet-name> is treated as <url-pattern> if under <filter-mapping>, the answer is "you are correct". Also, note that <servlet-mapping> is independent of <filter-mapping>. <servlet-name> appearing under <filter-mapping> is like an exact match.
However, note one difference between <url-pattern> and <servlet-name> under <filter-mapping>, the ordering of filters - which is very important - are different between the two. The container will first take all filters matching the url, first against all of the <url-pattern>, in the order it appears in the DD, and then will match against all of the <servlet-name>, in the order it appears in the DD.
hth.
[ December 14, 2005: Message edited by: M Jairam ]
 
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic