• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter not called

 
Jigs Mehta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a query as follows:

1. I call a jsp from my browser as "http://localhost:8080/myapp/test.jsp"
2. Now this page is a simple login form and accepts a username and password and then calls a servlet called "Authenticator".
3. this servlet basically checks the for username and password and forwards it to "/administrator/index.jsp".
4. I have a filter mapped to the URL "/administrator/index.jsp".
5. I want to know what should be the dispatcher tag contain if the servlet is forwarding the request using RequestDispatcher and secondly If the servlet is using response.sendRedirect() to forward to the index.jsp page.

Currently I am handling the forward by RequestDispatcher forward by making use of FORWARD value in the dispatcher element. My filter-mapping looks as follows:


Right now my filter is not being called when the servlet is foerwarding using response.sendRedirect("/administrator/index.jsp") due to the dispatcher element.
what should be the value included in the dispatcher element if I want the filter to be called for the response.sendRedirect() method?

I hope I am doing everything right.

Thanks in advance for all the help!!
 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the servlet specification,

"New since version 2.4 of the Java Servlet specification is the ability to configure
filters to be invoked under request dispatcher forward() and include() calls."
 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the <dispatcher>FORWARD</dispatcher> element completely. This should work since a redirect basically is like a new request from the client.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic