The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Filter question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Filter question" Watch "Filter question" New topic
Author

Filter question

Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1863
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.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Are you accessing the Servlet thru the servlet-name and not using the package structure in the URL?

- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1863
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

Joined: Jun 03, 2000
Posts: 5040
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

Joined: Nov 04, 2001
Posts: 1863
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

Joined: Jun 03, 2000
Posts: 5040
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
 
IntelliJ Java IDE
 
subject: Filter question
 
Threads others viewed
struts-2.1.6 -- 'dojo' is undefined
Filters and web.xml problem + Eclipse
Filter
Access DispatcherServlet in a GenericFilterBean
filter mapping to servlets
developer file tools