Here you can find the source of resolveRelativeURI(String baseURI, String uriRef)
Parameter | Description |
---|---|
baseURI | The base URI; if present, it must be an absolute URI. |
uriRef | A URI reference that may be relative to the given base URI. |
public static URI resolveRelativeURI(String baseURI, String uriRef)
//package com.java2s; //License from project: Apache License import java.net.URI; public class Main { /**/*w w w. j a v a 2 s . c o m*/ * Constructs an absolute URI from the given URI reference and a base URI. * * @see <a href="http://tools.ietf.org/html/rfc3986#section-5.2">RFC 3986, * 5.2</a> * * @param baseURI * The base URI; if present, it must be an absolute URI. * @param uriRef * A URI reference that may be relative to the given base URI. * @return The resulting URI. * */ public static URI resolveRelativeURI(String baseURI, String uriRef) { URI uri = (null != baseURI) ? URI.create(baseURI) : URI.create(""); if (null != baseURI && null == uri.getScheme()) { throw new IllegalArgumentException("Base URI has no scheme component: " + baseURI); } return uri.resolve(uriRef); } }