public class URIBuilder
extends java.lang.Object
URI
instance from scratch
or from an existing URI. This is useful for replacing components
inside an existing URI, which is immutable.Modifier and Type | Method and Description |
---|---|
java.net.URI |
build()
Constructs a new URI instance from the components of this
builder instance.
|
static URIBuilder |
builder()
Returns a builder to construct URI from scratch.
|
static URIBuilder |
builder(java.net.URI uri)
Returns a builder that is configured with the components
from the given URI.
|
URIBuilder |
fragment(java.lang.String fragment)
Sets the URI fragment and return this builder instance
for chaining.
|
URIBuilder |
host(java.lang.String host)
Sets the URI host and return this builder instance
for chaining.
|
URIBuilder |
path(java.lang.String path)
Sets the URI path and return this builder instance
for chaining.
|
URIBuilder |
port(int port)
Sets the URI port and return this builder instance
for chaining.
|
URIBuilder |
query(java.lang.String query)
Sets the URI query and return this builder instance
for chaining.
|
URIBuilder |
scheme(java.lang.String scheme)
Sets the URI scheme and return this builder instance
for chaining.
|
URIBuilder |
userInfo(java.lang.String userInfo)
Sets the URI user info and return this builder instance
for chaining.
|
public static URIBuilder builder()
public static URIBuilder builder(java.net.URI uri)
uri
- URI to modifypublic URIBuilder scheme(java.lang.String scheme)
scheme
- URI schemepublic URIBuilder userInfo(java.lang.String userInfo)
userInfo
- URI user infopublic URIBuilder host(java.lang.String host)
host
- URI hostpublic URIBuilder port(int port)
port
- URI portpublic URIBuilder path(java.lang.String path)
path
- URI pathpublic URIBuilder query(java.lang.String query)
query
- URI querypublic URIBuilder fragment(java.lang.String fragment)
fragment
- URI fragmentpublic java.net.URI build() throws java.net.URISyntaxException
java.net.URISyntaxException
- If the URI string constructed from
the given components violates RFC 2396