List of usage examples for org.apache.commons.httpclient HttpMethodBase getResponseBody
@Override public byte[] getResponseBody() throws IOException
From source file:org.zend.sdklib.internal.target.ApiKeyDetector.java
private String executeGetApiKeys(String url, Map<String, String> cookies) throws SdkException { HttpClient client = new HttpClient(); HttpMethodBase method = createGetRequest(url, new HashMap<String, String>()); setCookies(method, cookies);/*from w w w . j a v a 2 s . c o m*/ method.setRequestHeader("X-Accept", //$NON-NLS-1$ "application/vnd.zend.serverapi+json;version=1.3;q=1.0"); //$NON-NLS-1$ method.setRequestHeader("X-Request", "JSON"); //$NON-NLS-1$ //$NON-NLS-2$ if (method != null) { int statusCode = -1; try { statusCode = client.executeMethod(method); if (statusCode == 200) { String responseContent = new String(method.getResponseBody()); return responseContent; } } catch (IOException e) { throw new SdkException(e); } finally { method.releaseConnection(); } } return null; }