@SuppressWarnings("unchecked") // generic entries
    public void dispatch(HttpServletRequest req, HttpServletResponse resp) {
        try {
            final List<HandlersMappingEntry<?>> mapping;
            if("GET".equals(req.getMethod()) || "HEAD".equals(req.getMethod())) mapping = registryGet;
            else if("POST".equals(req.getMethod())) mapping = registryPost;
            else if("PUT".equals(req.getMethod())) mapping = registryPut;
            else if("DELETE".equals(req.getMethod())) mapping = registryDelete;
                // cannot happen, methods are filtered in servlet
            else throw new IllegalArgumentException("Unsupported HTTP method: '" + req.getMethod() + "'");
            for(HandlersMappingEntry en : mapping) {
                NamedMatcher matcher = en.matcher(req.getPathInfo());
                if(matcher.matches()) {
                    en.getTransportHandler().handle(en.getRestHandlerClass(), req, resp, matcher.namedGroups());
                    return;
                }
            }
            notFoundHandler.handle(this, req, resp);
        } catch(Exception e) {
            exceptionHandler.handle(e, req, resp);
        }
    }