Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.client.utils
Class URIBuilder

    java.lang.Object
      org.apache.http.client.utils.URIBuilder

    @NotThreadSafe
    public class URIBuilder

extends Object

`URI` builder for HTTP requests.

Since:
  4.2

Constructor Summary
`URIBuilder()` Constructs an empty instance.
`URIBuilder(String string)` Construct an instance from the string which must be a valid URI.
`URIBuilder(URI uri)` Construct an instance from the provided URI.

Method Summary
`URIBuilder` | `addParameter(String param, String value)` Adds parameter to URI query.
`URI` | `build()` Builds a `URI` instance.
`String` | `getFragment()`
`String` | `getHost()`
`String` | `getPath()`
`int` | `getPort()`
`List<NameValuePair>` | `getQueryParams()`
`String` | `getScheme()`
`String` | `getUserInfo()`
`URIBuilder` | `removeQuery()` Removes URI query.
`URIBuilder` | `setFragment(String fragment)` Sets URI fragment.
`URIBuilder` | `setHost(String host)` Sets URI host.
`URIBuilder` | `setParameter(String param, String value)` Sets parameter of URI query overriding existing value if set.
`URIBuilder` | `setPath(String path)` Sets URI path.
`URIBuilder` | `setPort(int port)` Sets URI port.
`URIBuilder` | `setQuery(String query)` Sets URI query.
`URIBuilder` | `setScheme(String scheme)` Sets URI scheme.
`URIBuilder` | `setUserInfo(String userInfo)` Sets URI user info.
`URIBuilder` | `setUserInfo(String username, String password)` Sets URI user info as a combination of username and password.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### URIBuilder

    public URIBuilder()

  Constructs an empty instance.

### URIBuilder

    public URIBuilder(String string)
               throws URISyntaxException

  Construct an instance from the string which must be a valid URI.

  Parameters:
    `string` - a valid URI in string form
  Throws:
    `URISyntaxException` - if the input is not a valid URI

### URIBuilder

    public URIBuilder(URI uri)

  Construct an instance from the provided URI.

  Parameters:
    `uri` -

Method Detail

### build

    public URI build()
              throws URISyntaxException

  Builds a `URI` instance.

  Throws:
    `URISyntaxException`

### setScheme

    public URIBuilder setScheme(String scheme)

  Sets URI scheme.

### setUserInfo

    public URIBuilder setUserInfo(String userInfo)

  Sets URI user info. The value is expected to be unescaped and may contain non ASCII characters.

### setUserInfo

    public URIBuilder setUserInfo(String username,
                                  String password)

  Sets URI user info as a combination of username and password. These values are expected to be unescaped and may contain non ASCII characters.

### setHost

    public URIBuilder setHost(String host)

  Sets URI host.

### setPort

    public URIBuilder setPort(int port)

  Sets URI port.

### setPath

    public URIBuilder setPath(String path)

  Sets URI path. The value is expected to be unescaped and may contain non ASCII characters.

### removeQuery

    public URIBuilder removeQuery()

  Removes URI query.

### setQuery

    public URIBuilder setQuery(String query)

  Sets URI query.

  The value is expected to be encoded form data.

### addParameter

    public URIBuilder addParameter(String param,
                                   String value)

  Adds parameter to URI query. The parameter name and value are expected to be unescaped and may contain non ASCII characters.

### setParameter

    public URIBuilder setParameter(String param,
                                   String value)

  Sets parameter of URI query overriding existing value if set. The parameter name and value are expected to be unescaped and may contain non ASCII characters.

### setFragment

    public URIBuilder setFragment(String fragment)

  Sets URI fragment. The value is expected to be unescaped and may contain non ASCII characters.

### getScheme

    public String getScheme()

### getUserInfo

    public String getUserInfo()

### getHost

    public String getHost()

### getPort

    public int getPort()

### getPath

    public String getPath()

### getQueryParams

    public List<NameValuePair> getQueryParams()

### getFragment

    public String getFragment()

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.