package cn.com.victorysoft.business.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * 过滤器工具类
 * @author stareast
 */
public class FilterUtils {
    public static String getFullUrlFromRequest(HttpServletRequest httRequest) {
        String url = httRequest.getRequestURI();
        String queryString = httRequest.getQueryString();
        if (null != queryString && !queryString.trim().equals("")) {
            url = url + "?" + queryString;
        }
        return url;
    }
    public static boolean isContainUrl(String urlList, String url) {
        boolean isExclude = false;
        if (null != urlList && !urlList.trim().equals("")) {
            String[] resources = urlList.split(",");
            if (null != resources) {
                for (int i = 0; i < resources.length; i++) {
                    if (null != resources[i] && !resources[i].equals(""))
                        if (url.indexOf(resources[i].trim()) >= 0) {
                            isExclude = true;
                            break;
                        }
                }
            }
        }
        return isExclude;
    }
}
