Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Filter question

 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i'm trying to have a filter which is applicable to only one Servlet.
i'm having filter specification in web.xml correctly. in <filter-mapping> defined like,

and here is my servlet name tag,

but the filter on the servlet doesn't get invoked when i run the servlet. there is no error or exception. i'm using tomcat 4.0.1.
but if i use <url-pattern>/*</url-pattern> tags then it works!
any idea regarding this? or i'm specifying something wrong...
regards
maulin.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you accessing the Servlet thru the servlet-name and not using the package structure in the URL?

- satya
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm using the package structure. otherwise it would have given me an error.
i use http://localhost:6000/examples/servlet/myexamples.filters.FilterTestServlet
to run the servlet and it is in myexamples.filters package.
the problem i have is when i say <url-pattern>/*</url-pattern> then it works! i have tested this but only when i use servlet-name then it doesnt work WITHOUT GIVING ANY DAMN EXCEPTION OR ERROR
regards
maulin.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i use [URL=http://localhost:6000/examples/servlet/myexamples.filters.FilterTestServlet[http://localhost:6000/examples/servlet/myexamples.filters.FilterTestServlet[/URL]
Thats what I thought. You have to use the servlet name not the package structure.....
Good luck.

- satya
[ March 05, 2002: Message edited by: Madhav Lakkapragada ]
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so its similar to <servlet-mapping>. right??? i thought servlet-name is a local ref in web.xml to ease the filter mapping task...
got u...
or i was going to use /examples/servlet/<packged-servlet-name> in web.xml in the <servlet-class> tag...i'll try will let u know...
now again i've lost access of servlet env so here goes my sig....
regards
maulin
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i thought servlet-name is a local ref in web.xml
Thats sounds dangerous. You need to better test this to get the concept.
- satya
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic