Below
snippet performs the GET request.
public static ResponseEntity<String> get(String url, Map<String, String> headers) {
if (url == null || url.isEmpty()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body("URL must not be null");
}
HttpEntity<Object> httpEntity = new HttpEntity<>(headers);
return REST_TEMPLATE.exchange(url, HttpMethod.GET, httpEntity, String.class);
}
You can
download complete working application from this link.
No comments:
Post a Comment