Here you can find the source of resolveUri(URI baseUri, URI requestedUri, URI matchedUri)
public static URI resolveUri(URI baseUri, URI requestedUri, URI matchedUri)
//package com.java2s; //License from project: Apache License import java.net.URI; public class Main { public static URI resolveUri(URI baseUri, URI requestedUri, URI matchedUri) { String relativePath = requestedUri.getPath().substring(matchedUri.getPath().length()); String result = baseUri.toString() + relativePath; if (requestedUri.getQuery() != null) { result += "?" + requestedUri.getQuery(); }/*from w w w . j a va 2 s . c o m*/ return URI.create(result); } }