Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Filter not called

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Ranch Hand
Posts: 128
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
MS IE Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Can't .... do .... plaid .... So I did this tiny ad instead:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic