jetbrick-webmvc/src/main/java/jetbrick/web/mvc/router/RestfulMatcher.java
public void register(ActionInfo action, String url) {
        if (url.indexOf('{') == -1) {
            staticUrls.put(url, new RouteInfo(action));
        } else {
            String[] urlSegments = StringUtils.split(url.substring(1), '/');
            if (urlSegments.length >= MAX_PATH_PARTS) {
                throw new IllegalStateException("exceed max url parts: " + url);
            }
            OneByOneMatcher matcher = matchers[urlSegments.length];
            if (matcher == null) {
                matcher = new OneByOneMatcher();
                matchers[urlSegments.length] = matcher;
            }
            matcher.register(action, urlSegments);
        }
    }
public void register(ActionInfo action, String url) {
        if (url.indexOf('{') == -1) {
            staticUrls.put(url, new RouteInfo(action));
        } else {
            String[] urlSegments = StringUtils.split(url.substring(1), '/');
            if (urlSegments.length >= MAX_PATH_PARTS) {
                throw new IllegalStateException("exceed max url parts: " + url);
            }
            OneByOneMatcher matcher = matchers[urlSegments.length];
            if (matcher == null) {
                matcher = new OneByOneMatcher();
                matchers[urlSegments.length] = matcher;
            }
            matcher.register(action, urlSegments);
        }
    }
public void register ( ActionInfo action , String url ) { if ( url . indexOf ( ' ' ) == - 1 ) { staticUrls . put ( url , new RouteInfo ( action ) ) ; } else { String [ ] urlSegments = StringUtils . split ( url . substring ( 1 ) , ' ' ) ; if ( urlSegments . length >= MAX_PATH_PARTS ) { throw new IllegalStateException ( "exceed max url parts: " + url ) ; } OneByOneMatcher matcher = matchers [ urlSegments . length ] ; if ( matcher == null ) { matcher = new OneByOneMatcher ( ) ; matchers [ urlSegments . length ] = matcher ; } matcher . register ( action , urlSegments ) ; } }
按照长度分组
按照长度分组