Package kong.unirest.core
Class Path
- java.lang.Object
-
- kong.unirest.core.Path
-
public class Path extends Object
Class for building a URI with query params
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbaseUrl()booleanequals(Object o)StringgetQueryString()inthashCode()voidparam(String name, String value)replace a single path param by namevoidparam(Map<String,Object> params)replace path params designated with curley braces with a valuevoidqueryString(String name, Object value)Add a query paramvoidqueryString(String name, Collection<?> value)Add a query param.voidqueryString(Map<String,Object> parameters)Add query params as a map of key/valuesStringrawPath()StringtoString()
-
-
-
Constructor Detail
-
Path
public Path(String url)
construct a path- Parameters:
url- the URL
-
-
Method Detail
-
param
public void param(Map<String,Object> params)
replace path params designated with curley braces with a value- Parameters:
params- a map of param names and values
-
param
public void param(String name, String value)
replace a single path param by name- Parameters:
name- the name of the path paramvalue- the value to replace it with
-
queryString
public void queryString(String name, Collection<?> value)
Add a query param. This will result in a query param per value- Parameters:
name- the namevalue- a collection of values
-
queryString
public void queryString(String name, Object value)
Add a query param- Parameters:
name- the namevalue- the value
-
queryString
public void queryString(Map<String,Object> parameters)
Add query params as a map of key/values- Parameters:
parameters- the params to add
-
rawPath
public String rawPath()
- Returns:
- the full raw path
-
baseUrl
public String baseUrl()
- Returns:
- the URL without the query string
-
getQueryString
public String getQueryString()
- Returns:
- just the query string
-
-