Interface RequestURI


  • @Immutable
    public interface RequestURI
    Request URI.

    Instance of this interface is returned by Request.uri(), and can be modified using one of the methods below. When modification is done, method back() returns a modified instance of Request, for example:

     new JdkRequest("http://my.example.com")
       .header("Accept", "application/json")
       .uri()
       .path("/users")
       .queryParam("name", "Jeff Lebowski")
       .back() // returns a modified instance of Request
       .fetch()

    Instances of this interface are immutable and thread-safe.

    Since:
    0.8
    Suppressed Checkstyle violations:
    AbbreviationAsWordInNameCheck (100 lines)
    • Method Detail

      • back

        Request back()
        Get back to the request it's related to.
        Returns:
        The request we're in
      • get

        URI get()
        Get URI.
        Returns:
        The destination it is currently pointing to
      • set

        RequestURI set​(URI uri)
        Set URI.
        Parameters:
        uri - URI to set
        Returns:
        New alternated URI
      • queryParam

        RequestURI queryParam​(String name,
                              Object value)
        Add query param.
        Parameters:
        name - Query param name
        value - Value of the query param to set
        Returns:
        New alternated URI
      • queryParams

        RequestURI queryParams​(Map<String,​String> map)
        Add query params.
        Parameters:
        map - Map of params to add
        Returns:
        New alternated URI
      • path

        RequestURI path​(String segment)
        Add URI path.
        Parameters:
        segment - Path segment to add
        Returns:
        New alternated URI
      • userInfo

        RequestURI userInfo​(String info)
        Set user info.
        Parameters:
        info - User info part to set
        Returns:
        New alternated URI
      • port

        RequestURI port​(int num)
        Set port number.
        Parameters:
        num - The port number to set
        Returns:
        New altered URI