Here you can find the source of createURI(String scheme, String host, String path)
public static URI createURI(String scheme, String host, String path)
//package com.java2s; //License from project: Apache License import java.net.URI; public class Main { public static URI createURI(String scheme, String host, String path) { String uri = scheme + "://" + host + path; return createURI(uri); }//from ww w . j ava 2s . c om public static URI createURI(String uri) { if (uri.endsWith("/") && uri.length() > 1) { uri = uri.substring(0, uri.length() - 1); } try { return new URI(uri); } catch (Exception e) { throw new IllegalArgumentException("Invalid uri - " + uri); } } }