class HttpFilter extends GenericFilter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
            HttpServletRequest httpServletRequest = (HttpServletRequest) request;
            HttpServletResponse httpServletResponse = (HttpServletResponse) response;
            this.doFilter(httpServletRequest, httpServletResponse, chain);
        } else {
            throw new ServletException("not a HTTP request or a HTTP response");
        }

    }

}