Here you can find the source of GetURI(String host, String port, String resource)
public static String GetURI(String host, String port, String resource) throws MalformedURLException, URISyntaxException
//package com.java2s; //License from project: LGPL import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; public class Main { public static String GetURI(String host, String port, String resource) throws MalformedURLException, URISyntaxException { if (!resource.startsWith("/")) { resource = "/" + resource; }// w w w. jav a 2 s . c o m int portValue = 80; if (port.length() > 0) { portValue = Integer.parseInt(port); } return new URL("http", host, portValue, resource).toURI().toString(); } }