How to exclude particular format of URL from the filter?
Is there a standard method or alternative solution ?
How to exclude particular format of URL from the filter?
Is there a standard method or alternative solution ?
This isn't possible via <url-pattern>
configuration.
You've basically 2 options:
Make <url-pattern>
more specific. E.g. move all those resources wich really need to be filtered in a specific folder like /app
and set the <url-pattern>
to /app/*
. Then you can just put the excluded page outside that folder.
Check for the request URI in the filter and just continue the chain if it represents the excluded page.
E.g.
String loginURL = request.getContextPath() + "/login.jsp";
if (request.getRequestURI().equals(loginURL)) {
chain.doFilter(request, response);
}
else {
// ...
}