Java Servlet Filter Redirection Issue

I have a problem with an authentication filter. When a filter redirects to the login page, images are not displayed in the login JSP. However, if I go to the login page manually after logging in, images will be displayed.

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

AuthFilter:

if (authorized == null && path.indexOf("Auth") == -1 && path.indexOf("Login") == -1 ) {
        httpResponse.sendRedirect("Login");  
        return;  
} else {  
        chain.doFilter(request, response);  
}

Input Servlet:

// Just using a servlet in case I want more data sent to the jsp
Dispatcher.dispatch("views/login.jsp", request, response);

login.jsp:

<img src="images/logo.png" />

jsp is otherwise "normal", all necessary HTML tags are present. The "images" folder is located in the default "web" folder of the project, along with all other jsp and javascripts.

Thanks in advance for any help. :)
- Stian

+5
source share
2

- .

  • Login
  • , , /views/images/
  • URL.

, , /images ( ) /views/images/

. :

  • ;
  • ; .

: , . :

  • .png,.jpeg,.css .. . request.getRequestURI()
+7

, logo.png login.jsp?

, filter-mapping web.xml.

+2

All Articles