com.h3c.util

## Class WebUtils.Url

- java.lang.Object
- - com.h3c.util.WebUtils.Url

- Enclosing class:
    WebUtils

      public static class WebUtils.Url
      extends Object

  A simple class to facilitate building URLs used to interact with servlets. For example, typical usage might be:

       WebUtils.Url url = new WebUtils.Url("someServlet")
                        .param("name", nameField.getValue())
                        .param("pass", passwordField.getValue());
       RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url.toString());
       ...

  The URL supplied to the request builder might be something like:

       "someServlet?name=Simon&pass=SeCrEt"

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebUtils.Url(String url)` Constructs a url with the specified base path.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `WebUtils.Url` | `add(String path)` Adds a path segment to the end of the URL.
    `WebUtils.Url` | `param(String name, Object value)` Adds a parameter to the 'query string'.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### WebUtils.Url

          public WebUtils.Url(String url)

      Constructs a url with the specified base path.
      Parameters:
        `url` - the base url

  - ### Method Detail

    - #### add

          public WebUtils.Url add(String path)

      Adds a path segment to the end of the URL.
      Parameters:
        `path` - path segment to be appended to the URL.
      Returns:
        self

    - #### param

          public WebUtils.Url param(String name,
                           Object value)

      Adds a parameter to the 'query string'. This method returns a reference to the Url instance, allowing method calls to be chained.
      Parameters:
        `name` - the name of the parameter
        `value` - the value of the parameter
      Returns:
        self

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014. All Rights Reserved.