• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Filtering Question

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to do authentication in a ServletFilter. I mapped the filter to /* in the deployment descriptor. In the doFilter method, I say, if you are not logged in, then you are forwarded to the login page. The problem with this is that the images that I am trying to display on my login.jsp page will no longer show up because the filter will not let the requests for the images get through. I inserted some code into the doFilter method that said if "gif" appears in the request, then call filterChain.doFilter(request, response) but if not, then check for an existing session. The images will display properly when I do this but I know that doing so is not the correct way to write a ServletFilter. Can anyone give me some advice on how to fix this problem? Thanks a lot.
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you should think about putting your 'protected' pages versus 'login' page versus 'images' into a folder structure, and only apply the filter to 'protected' ones.
/
-- login page
/images
-- all your images
/protected
-- all your pages which require login first
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic