public class RestClientUtil extends Object
| Constructor and Description |
|---|
RestClientUtil(int connectionTimeout,
int socketTimeout)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
String |
executeGet(String urlStr,
String defaultValue)
Executes a HTTP GET to the given url
|
boolean |
executePost(String urlStr,
String body)
Executes a HTTP JSON POST to the given url, with the provided json string
|
public RestClientUtil(int connectionTimeout,
int socketTimeout)
connectionTimeout - connectionTimeout in millisecondssocketTimeout - socketTimeout in millisecondspublic boolean executePost(String urlStr, String body) throws IOException
urlStr - URL to invokebody - JSON request body, as stringIOException - there's a communication errorpublic String executeGet(String urlStr, String defaultValue) throws IOException
urlStr - URL to invokedefaultValue - default value to return if the http response is not HTTP_OKIOException - there's a communication errorCopyright © 2016–2021. All rights reserved.