Java URI to Relative URI resolveReferenceStartingWithQueryString(final URI baseURI, final URI reference)

Here you can find the source of resolveReferenceStartingWithQueryString(final URI baseURI, final URI reference)

Description

Resolves a reference starting with a query string.

License

Apache License

Parameter

Parameter Description
baseURI the base URI
reference the URI reference starting with a query string

Return

the resulting URI

Declaration

private static URI resolveReferenceStartingWithQueryString(final URI baseURI, final URI reference) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.*;

public class Main {
    /**//from w  ww  .jav  a 2s  .  co m
     * Resolves a reference starting with a query string.
     *
     * @param baseURI   the base URI
     * @param reference the URI reference starting with a query string
     * @return the resulting URI
     */
    private static URI resolveReferenceStartingWithQueryString(final URI baseURI, final URI reference) {
        String baseUri = baseURI.toString();
        baseUri = baseUri.indexOf('?') > -1 ? baseUri.substring(0, baseUri.indexOf('?')) : baseUri;
        return URI.create(baseUri + reference.toString());
    }
}

Related

  1. resolveFileNameNoExt(URI uri)
  2. resolveFileUri(String fullPageURI, File rootPath)
  3. resolvePartUri(URI sourcePartUri, URI targetUri)
  4. resolvePath(URI root, String subPath)
  5. resolvePort(URI uri)
  6. resolveRelativeURI(String baseURI, String uriRef)
  7. resolveRelativeURI(URI base, String rel)
  8. resolveURI(File base_dir, URI uri)
  9. resolveURI(final String path)