Package com.liveperson.faas.http
Class DefaultRestClient
- java.lang.Object
-
- com.liveperson.faas.http.DefaultRestClient
-
- All Implemented Interfaces:
RestClient
public class DefaultRestClient extends Object implements RestClient
-
-
Constructor Summary
Constructors Constructor Description DefaultRestClient()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringget(String url, Map<String,String> headers)Execute a http get callStringget(String url, Map<String,String> headers, int timeOutInMs)Execute a http get callStringpost(String url, Map<String,String> headers, String jsonBody)Execute a http post callStringpost(String url, Map<String,String> headers, String jsonBody, int timeOutInMs)Execute a http post call
-
-
-
Method Detail
-
post
public String post(String url, Map<String,String> headers, String jsonBody) throws IOException
Description copied from interface:RestClientExecute a http post call- Specified by:
postin interfaceRestClient- Parameters:
url- the url to the API endpointheaders- the headers values mapjsonBody- the json body as string- Returns:
- response body as string
- Throws:
IOException- when response can not be read
-
post
public String post(String url, Map<String,String> headers, String jsonBody, int timeOutInMs) throws IOException
Description copied from interface:RestClientExecute a http post call- Specified by:
postin interfaceRestClient- Parameters:
url- the url to the API endpointheaders- the headers values mapjsonBody- the json body as stringtimeOutInMs- time after which request times out- Returns:
- response body as string
- Throws:
IOException- when response can not be read
-
get
public String get(String url, Map<String,String> headers, int timeOutInMs) throws IOException
Description copied from interface:RestClientExecute a http get call- Specified by:
getin interfaceRestClient- Parameters:
url- the url to the API endpointheaders- the headers values maptimeOutInMs- time after which request times out- Returns:
- response body as string
- Throws:
IOException- when response can not be read
-
get
public String get(String url, Map<String,String> headers) throws IOException
Description copied from interface:RestClientExecute a http get call- Specified by:
getin interfaceRestClient- Parameters:
url- the url to the API endpointheaders- the headers values map- Returns:
- response body as string
- Throws:
IOException- when response can not be read
-
-