public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain filter) throws IOException, ServletException {
        String api = request.getParameter("api");
        if (null == api) {
            String queryString = ((HttpServletRequest) request)
                    .getQueryString();
            if (queryString.length() > 0) {
                Pattern pattern = Pattern
                        .compile("(\\?|&){0,1}api=(.*?)&{0,1}");
                Matcher matcher = pattern.matcher(queryString);
                if (matcher.matches() && matcher.groupCount() >= 2) {
                    api = matcher.group(2);
                }
            }
        }

        if (null != api
                && !"link".equalsIgnoreCase(api)
                && !"logout".equalsIgnoreCase(api)
                && !"flush".equalsIgnoreCase(api)
                && null == ((HttpServletRequest) request).getSession()
                        .getAttribute(Account.ACCOUNT_SESSION_KEY)) {
            ((HttpServletResponse) response)
                    .sendRedirect(((HttpServletRequest) request)
                            .getContextPath() + "/error.jsp?desc=UnLogin");
            return;
        }

        filter.doFilter(request, response);
    }