code: public String getStringContent(String url, int expectedStatusCode) {
          GetMethod method = new GetMethod(url);
          try {
              int statusCode = client.executeMethod(method);
              if (statusCode == expectedStatusCode) {
                  InputStream is = method.getResponseBodyAsStream();
                  return IOUtils.toString(is, "UTF-8");
              } else {
                  throw new ClientException(String.format("Received status code %d, expected %d - url %s", statusCode, expectedStatusCode,
                          url));
              }
          } catch (IOException e) {
              throw new ClientException("Unable to complete request to " + url, e);
          }
      }
docs: Retrieves the content available at {@code url} as a {@link String}. The server must respond with a status code equal to {@code
  expectedStatusCode}, otherwise this method will throw a {@link ClientException};
  
  @param url                the URL from which to retrieve the content
  @param expectedStatusCode the expected status code from the server
  @return the content, as a {@link String}
  @throws ClientException if the server's status code differs from the {@code expectedStatusCode} or if any other error is encountered