public URL toUrl()

in dubbo-admin-server/src/main/java/org/apache/dubbo/admin/model/domain/Route.java [211:228]


    public URL toUrl() {
        String[] detachResult = ConvertUtil.detachId(service);
        String group = null;
        String version = null;
        String interfaze = detachResult[0];
        if (detachResult.length > 1) {
            version = detachResult[1];
        }
        if (detachResult.length > 2) {
            group = detachResult[2];
        }
        return URL.valueOf(Constants.ROUTE_PROTOCOL + "://" + Constants.ANYHOST_VALUE + "/" + interfaze
                + "?" + Constants.CATEGORY_KEY + "=" + Constants.ROUTERS_CATEGORY
                + "&router=condition&runtime=" + isRuntime() + "&enabled=" + isEnabled() + "&priority=" + getPriority() + "&force=" + (getMatchRule().contains("host") ? "true" : isForce()) + "&dynamic=" + isDynamic()
                + "&name=" + getName() + "&" + Constants.RULE_KEY + "=" + URL.encode(getMatchRule() + " => " + (getMatchRule().contains("host") ? "false" : getFilterRule()))
                + (group == null ? "" : "&" + Constants.GROUP_KEY + "=" + group)
                + (version == null ? "" : "&" + Constants.VERSION_KEY + "=" + version));
    }