public void doFilter(ServletRequest _request, ServletResponse _response, FilterChain chain) throws IOException, ServletException {
        if (_request instanceof HttpServletRequest && _response instanceof HttpServletResponse) {
            HttpServletRequest request = (HttpServletRequest) _request;
            HttpServletResponse response = (HttpServletResponse) _response;

            request = new MapHttpServletRequest(request);
            processPath((MapHttpServletRequest) request);

            request.setAttribute(AttributeNames.REQUEST_URI, request.getRequestURI());
            request.setAttribute(AttributeNames.REQUEST_URL, request.getRequestURL().toString());

            String path = request.getRequestURI().substring(request.getContextPath().length());
            Object target = pages.resolve((MapHttpServletRequest) request, path, HttpMethods.getMethod(request.getMethod()));

            request.setAttribute(AttributeNames.PATH, path);

            if (target instanceof ServletAction) {
                ((ServletAction) target).invoke(request, response);
                return;
            } else if (target instanceof Page) {
                request.setAttribute(AttributeNames.PATH_SET, lookupPaths(target.getClass()));
                request.setAttribute(AttributeNames.PAGE, target);

                if (dispatchServlet == null) {
                    ((Page) target).service(servletContext, request, response);
                } else {
                    request.getRequestDispatcher(dispatchServlet).forward(request, response);
                }

                return;
            }
        }

        chain.doFilter(_request, _response);
    }