Here you can find the source of getUrl(String ip, String port, String servicePath, String serviceName, String... args)
public static String getUrl(String ip, String port, String servicePath, String serviceName, String... args) throws UnsupportedEncodingException
//package com.java2s; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String getUrl(String ip, String port, String servicePath, String serviceName, String... args) throws UnsupportedEncodingException { StringBuilder params = new StringBuilder(); params.append("http://"); params.append(ip);/*ww w. j a v a2s.c o m*/ params.append(":"); params.append(port); params.append(servicePath); params.append(serviceName); // args for (String arg : args) { params.append("/"); params.append(URLEncoder.encode(arg, "UTF-8")); } return params.toString(); } }