private static String getIdentityDocument ( final HttpClient client ) throws IOException { try { final HttpGet getInstance = new HttpGet ( ) ; getInstance . setURI ( INSTANCE_IDENTITY_URI ) ; final HttpResponse response = client . execute ( getInstance ) ; if ( response . getStatusLine ( ) . getStatusCode ( ) != HttpStatus . SC_OK ) { throw new IOException ( "failed to get instance identity, tried: " + INSTANCE_IDENTITY_URL + ", response: " + response . getStatusLine ( ) . getReasonPhrase ( ) ) ; } return EntityUtils . toString ( response . getEntity ( ) ) ; } catch ( Exception e ) { throw new IOException ( "failed to get instance identity" , e ) ; } }
Gets the body of the content returned from a GET request to uri .