I’m filtering every urls i.e. using @WebFilter("/*"). User needs to be logged in to view any page, if he’s not he’s redirected to /login.do page.
Now the problem comes up when user goes to login.do page because the as the user is not logged in other requests i.e. requests for fetching .js, .css, .jpg, .png etc are also redirected to login.do page.
I tried the following code:
if(requestedUri.matches(".*[css|jpg|png|gif|js].*")){
chain.doFilter(request, response);
return;
}
but in that case, all pages becomes accessible without even being logged in. So, basically I need a way to exclude css, jpg, js files’ url from filtering.
Any help? thanks in advance.
Sorry! that was my silly mistake. the regex was not correct!
that should be
.*(css|jpg|png|gif|js)