How can I just EXCLUDE the /welcome.do url-pattern to be intercepted by the Filter ?
You can use request.getServletPath() function to see if resource "/welcome.do" is being accessed, if so just invoke the regular filterchain else check for auth token (cookie/session attribute - whichever way you have implemented it) if auth token available continue with filtechain else redirect to login page.
If you want to avoid hard coding in your filter then probably the option suggested by sawan is a good option.
Hope this helps.
SCWCD 1.4<br />---------------------<br />Ability is what you're capable of. <br />Motivation determines what you do. <br />Attitude determines how well you do it.<br />---------------------
if u dont call FilterChain.doFilter(), then servlet or JSP mapped for /welcome.do won't be invoked right.. is that what u are looking for Vince?
If a request maps to two url pattern (/*.do and /welcome.do in our case) all the requests that come for /welcome.do will invoke NormalAccessFilter and if in this filter we are calling FilterChain.doFilter() then only the filters will be called in the chain.
Hope that helps.
Joined: Feb 11, 2003
Sawan, I got some confusion, I conclude my requirement:
*.do (except welcome.do) --> intercepted by AuthenFilter welcome.do --> don't intercepted by AuthenFilter
In this case, "welcome.do" will be served by NormalAccessFilter THEN AuthenFilter.
If I don't call FilterChain.doFilter() in the NormalAccessFilter, then welcome.do will not be invoked, this is NOT I wanted.
Joined: Aug 24, 2004
Hello Vince, I should have explained this in more detail . There are many ways to implement this but the way I was suggesting is :
When the request for /welcome.do will come it will be intercepted by NormalAccessFilter. As this filter is not calling others in chain here you can dispatch the request to any resource that you want. That means in normal access filter you can dispatch to /welcome.do and it will work. Sorry, I forgot to mention that you need to dispatch the request in my previous posts.
For the second case all other requests will be intercepted by AuthFilter which you call this in chain so that you don't need to dispatch to any other resource.
Hope it is clear.
Joined: Feb 11, 2003
Thanks Sawan, I finally got the solution:
When the request for /welcome.do will come it will be intercepted by NormalAccessFilter. As this filter is not calling others in chain here you can dispatch the request to any resource that you want. That means in normal access filter you can dispatch to /welcome.do and it will work
Treat NormalAccessFilter as a filter that /* stop any follow filter chain and dispatch to the request resource directly */.