Here you can find the source of uri(String value)
public static URI uri(String value)
//package com.java2s; //License from project: Apache License import java.net.URI; import java.net.URISyntaxException; public class Main { public static URI uri(String value) { try {// w w w. java 2 s. c om return new URI(value); } catch (URISyntaxException e) { e.printStackTrace(); throw new IllegalArgumentException("Invalid URI: " + value); } } public static URI uri(URI parent, String relative) { if (!relative.startsWith("/")) { relative = "/" + relative; } if (parent.toString().contains("#")) { return uri(parent.toString() + relative); } else { return uri(parent.toString() + "#" + relative); } } }