Java Servlet Filter redirect problem -


I am having trouble with my certification filter when the login login page redirects, if any image is displayed in JSP login Does not happen. However, if I go to the login page manually on the login page, images are displayed.

I do not understand why this is happening! I appreciate any help: -)

AuthFilter:

  if (authorized == tap & amp; path.indexOf ("AUTH") = = -1 & amp; Index IndexOf ("Login") == -1) {httpResponse.sendRedirect ("Login"); Return; } And {chain.doFilter (request, response); } Login servlet:  
  // Just using a servicelet, I want to send more data to JSP Dispatcher.dispatch ("View / Login.jsp ", request, feedback);  

login.jsp:

  & lt; Img src = "picture / logo.png" />  

jsp is otherwise "normal", all the required HTML tags are present. The "Images" folder is in the project's default "Web" folder, with all other jsp and javascripts.

Thanks in advance for any help.

This is due to relative path

  • Your log in is in the context of the
  • Your images may be / views / images /
  • As you move forward, The browser only knows the requested URL.

So when you move forward, the images are requested on / images> (because / views / images /

Two options:

  • Do not exceed your topmost; Redirect instead
  • Do not redirect from filter to servlet ; Directly redirect to login page

Update: Make sure images are not affected by filter Two options:

  • Filter them Pattern should not be matched
  • The filter should not have redirection for .png, .jpeg, .css, etc. It should be request.getRequestURI ()
  • Check with

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -