@Test public void testLocalhost() throws Exception { final String scheme="https"; final InetAddress host=InetAddress.getLocalHost(); final String specials="/abcd!$&*()_-+.,=:;'~@[]?<>|#^%\"{}\\\u00a3`\u00ac\u00a6xyz"; final URI uri = new URI(scheme, specials, host.getHostAddress(), 80, specials, specials, specials); final URI bld = URIBuilder.localhost() .setScheme(scheme) .setUserInfo(specials) .setPath(specials) .setCustomQuery(specials) .setFragment(specials) .build(); Assert.assertEquals(uri.getHost(), bld.getHost()); Assert.assertEquals(uri.getUserInfo(), bld.getUserInfo()); Assert.assertEquals(uri.getPath(), bld.getPath()); Assert.assertEquals(uri.getQuery(), bld.getQuery()); Assert.assertEquals(uri.getFragment(), bld.getFragment()); }
public static URIBuilder localhost() throws UnknownHostException { return new URIBuilder().setHost(InetAddress.getLocalHost()); }
URIBuilder { public static URIBuilder localhost() throws UnknownHostException { return new URIBuilder().setHost(InetAddress.getLocalHost()); } }
URIBuilder { public static URIBuilder localhost() throws UnknownHostException { return new URIBuilder().setHost(InetAddress.getLocalHost()); } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); }
URIBuilder { public static URIBuilder localhost() throws UnknownHostException { return new URIBuilder().setHost(InetAddress.getLocalHost()); } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); static URIBuilder localhost(); static URIBuilder loopbackAddress(); URIBuilder setCharset(final Charset charset); Charset getCharset(); URI build(); URIBuilder setScheme(final String scheme); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final NameValuePair... nvps); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final List <NameValuePair> nvps); URIBuilder setUserInfo(final String userInfo); @Deprecated URIBuilder setUserInfo(final String username, final String password); URIBuilder setHost(final InetAddress host); URIBuilder setHost(final String host); URIBuilder setHttpHost(final HttpHost httpHost ); URIBuilder setPort(final int port); URIBuilder setPath(final String path); URIBuilder setPathSegments(final String... pathSegments); URIBuilder setPathSegmentsRootless(final String... pathSegments); URIBuilder setPathSegments(final List<String> pathSegments); URIBuilder setPathSegmentsRootless(final List<String> pathSegments); URIBuilder removeQuery(); URIBuilder setParameters(final List <NameValuePair> nvps); URIBuilder addParameters(final List <NameValuePair> nvps); URIBuilder setParameters(final NameValuePair... nvps); URIBuilder addParameter(final String param, final String value); URIBuilder setParameter(final String param, final String value); URIBuilder clearParameters(); URIBuilder setCustomQuery(final String query); URIBuilder setFragment(final String fragment); boolean isAbsolute(); boolean isOpaque(); String getScheme(); String getSchemeSpecificPart(); String getUserInfo(); String getHost(); int getPort(); boolean isPathEmpty(); List<String> getPathSegments(); String getPath(); boolean isQueryEmpty(); List<NameValuePair> getQueryParams(); String getFragment(); @Override String toString(); }
URIBuilder { public static URIBuilder localhost() throws UnknownHostException { return new URIBuilder().setHost(InetAddress.getLocalHost()); } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); static URIBuilder localhost(); static URIBuilder loopbackAddress(); URIBuilder setCharset(final Charset charset); Charset getCharset(); URI build(); URIBuilder setScheme(final String scheme); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final NameValuePair... nvps); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final List <NameValuePair> nvps); URIBuilder setUserInfo(final String userInfo); @Deprecated URIBuilder setUserInfo(final String username, final String password); URIBuilder setHost(final InetAddress host); URIBuilder setHost(final String host); URIBuilder setHttpHost(final HttpHost httpHost ); URIBuilder setPort(final int port); URIBuilder setPath(final String path); URIBuilder setPathSegments(final String... pathSegments); URIBuilder setPathSegmentsRootless(final String... pathSegments); URIBuilder setPathSegments(final List<String> pathSegments); URIBuilder setPathSegmentsRootless(final List<String> pathSegments); URIBuilder removeQuery(); URIBuilder setParameters(final List <NameValuePair> nvps); URIBuilder addParameters(final List <NameValuePair> nvps); URIBuilder setParameters(final NameValuePair... nvps); URIBuilder addParameter(final String param, final String value); URIBuilder setParameter(final String param, final String value); URIBuilder clearParameters(); URIBuilder setCustomQuery(final String query); URIBuilder setFragment(final String fragment); boolean isAbsolute(); boolean isOpaque(); String getScheme(); String getSchemeSpecificPart(); String getUserInfo(); String getHost(); int getPort(); boolean isPathEmpty(); List<String> getPathSegments(); String getPath(); boolean isQueryEmpty(); List<NameValuePair> getQueryParams(); String getFragment(); @Override String toString();  }