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, methodback()
returns a modified instance ofRequest
, 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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Request
back()
Get back to the request it's related to.URI
get()
Get URI.RequestURI
path(String segment)
Add URI path.RequestURI
port(int num)
Set port number.RequestURI
queryParam(String name, Object value)
Add query param.RequestURI
queryParams(Map<String,String> map)
Add query params.RequestURI
set(URI uri)
Set URI.RequestURI
userInfo(String info)
Set user info.
-
-
-
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 namevalue
- 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
-
-