Package com.jcabi.http
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 Summary
Modifier and TypeMethodDescriptionback()Get back to the request it's related to.get()Get URI.Add URI path.port(int num) Set port number.queryParam(String name, Object value) Add query param.queryParams(Map<String, String> map) Add query params.Set URI.Set user info.
-
Method Details
-
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
Set URI.- Parameters:
uri- URI to set- Returns:
- New alternated URI
-
queryParam
Add query param.- Parameters:
name- Query param namevalue- Value of the query param to set- Returns:
- New alternated URI
-
queryParams
Add query params.- Parameters:
map- Map of params to add- Returns:
- New alternated URI
-
path
Add URI path.- Parameters:
segment- Path segment to add- Returns:
- New alternated URI
-
userInfo
Set user info.- Parameters:
info- User info part to set- Returns:
- New alternated URI
-
port
Set port number.- Parameters:
num- The port number to set- Returns:
- New altered URI
-