public final class UrlBuilder extends Object
| Constructor and Description |
|---|
UrlBuilder() |
| Modifier and Type | Method and Description |
|---|---|
String |
host()
Get the host that has been assigned to this UrlBuilder.
|
static UrlBuilder |
parse(String url)
Parse a UrlBuilder from the provided URL string.
|
static UrlBuilder |
parse(URL url)
Parse a UrlBuilder from the provided URL object.
|
String |
path()
Get the path that has been assigned to this UrlBuilder.
|
Integer |
port()
Get the port that has been assigned to this UrlBuilder.
|
Map<String,String> |
query()
Get the query that has been assigned to this UrlBuilder.
|
String |
scheme()
Get the scheme/protocol that has been assigned to this UrlBuilder.
|
UrlBuilder |
setQueryParameter(String queryParameterName,
String queryParameterEncodedValue)
Set the provided query parameter name and encoded value to query string for the final URL.
|
String |
toString()
Get the string representation of the URL that is being built.
|
URL |
toURL()
Get the URL that is being built.
|
UrlBuilder |
withHost(String host)
Set the host that will be used to build the final URL.
|
UrlBuilder |
withPath(String path)
Set the path that will be used to build the final URL.
|
UrlBuilder |
withPort(int port)
Set the port that will be used to build the final URL.
|
UrlBuilder |
withPort(String port)
Set the port that will be used to build the final URL.
|
UrlBuilder |
withQuery(String query)
Set the query that will be used to build the final URL.
|
UrlBuilder |
withScheme(String scheme)
Set the scheme/protocol that will be used to build the final URL.
|
public UrlBuilder withScheme(String scheme)
scheme - The scheme/protocol that will be used to build the final URL.public String scheme()
public UrlBuilder withHost(String host)
host - The host that will be used to build the final URL.public String host()
public UrlBuilder withPort(String port)
port - The port that will be used to build the final URL.public UrlBuilder withPort(int port)
port - The port that will be used to build the final URL.public Integer port()
public UrlBuilder withPath(String path)
path - The path that will be used to build the final URL.public String path()
public UrlBuilder setQueryParameter(String queryParameterName, String queryParameterEncodedValue)
queryParameterName - The name of the query parameter.queryParameterEncodedValue - The encoded value of the query parameter.public UrlBuilder withQuery(String query)
query - The query that will be used to build the final URL.public Map<String,String> query()
public URL toURL() throws MalformedURLException
MalformedURLException - if the URL is not fully formed.public String toString()
public static UrlBuilder parse(String url)
url - The string to parse.public static UrlBuilder parse(URL url)
url - The URL object to parse./**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/