Here you can find the source of getBaseURI(final URI uri)
Parameter | Description |
---|---|
uri | The URI. May be null . |
public static URI getBaseURI(final URI uri)
//package com.java2s; //License from project: Apache License import java.net.URI; import java.net.URISyntaxException; public class Main { /**// www . j a v a2 s . c o m * Gets the base part (schema, host, port and path) of the specified * URI. * * @param uri The URI. May be {@code null}. * * @return The base part of the URI, {@code null} if the original URI * is {@code null} or doesn't specify a protocol. */ public static URI getBaseURI(final URI uri) { if (uri == null) return null; try { return new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), uri.getPath(), null, null); } catch (URISyntaxException e) { return null; } } }