I\'m trying to follow the pattern at Design Patterns web based applications. It all works fine part from when it comes to maping \"root\" URLs.
I\'d like to put all
Why do we need to map each and every URL. In case you need to map all the URL, you might need skip URL in the filter.
SessionFilter
SessionFilter
com.colabcom.goshare.app.base.filter.SessionFilter
sessionFilter
/*
In Your Filter,
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
String url = request.getServletPath();
boolean allowedRequest = Utility.filterURL(url, avoidUrls);
if(allowedRequest){
chain.doFilter(request, response);
}else{
//Main Filter Code
}
Utility Class to filter your URL:
public static boolean filterURL(String str, List avoidURLList) {
boolean exist = false;
if(avoidURLList == null){
return exist;
}
for (int i = 0; i < avoidURLList.size(); i++) {
if (str.contains(avoidURLList.get(i))) {
exist = true;
break;
}
}
return exist;
}
Else you can map specific URL in your web.xml like
sessionFilter
*.action