Netty4ClientHttpRequest代码赏析

    private static int getPort(URI uri) {
        int port = uri.getPort();
        if (port == -1) {
            if ("http".equalsIgnoreCase(uri.getScheme())) {
                port = 80;
            }
            else if ("https".equalsIgnoreCase(uri.getScheme())) {
                port = 443;
            }
        }
        return port;
    }
getScheme()用的非常漂亮。
posted @ 2017-06-06 10:50  任国强  阅读(843)  评论(0编辑  收藏  举报