package rabbit;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

public class ApplicationStatusChecker {

    public HttpStatus checkStatus(String url) {
        RestTemplate restTemplate = new RestTemplate();
        ResponseEntity<?> response = restTemplate.getForEntity(url, null);
        return response.getStatusCode();
    }
}

package rabbit;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

public class ApplicationStatusChecker {

    public String checkStatus(String url) {
        RestTemplate restTemplate = new RestTemplate();
        ResponseEntity<?> response = restTemplate.getForEntity(url, String.class);
        return "statusCode: " + response.getStatusCode() +"\nbody: " + response.getBody();
    }

}

Return status code and body for HTTP request.
Return status code and body for HTTP request.
