List of usage examples for org.apache.http.client.methods HttpEntityEnclosingRequestBase setEntity
public void setEntity(final HttpEntity entity)
From source file:org.bigmouth.nvwa.network.http.HttpClientHelper.java
public static void addPair(HttpEntityEnclosingRequestBase requestBase, NameValuePair... pairs) throws UnsupportedEncodingException { List<NameValuePair> list = Lists.newArrayList(pairs); requestBase.setEntity(new UrlEncodedFormEntity(list, DEFAULT_CHARSET)); }
From source file:org.bigmouth.nvwa.network.http.HttpClientHelper.java
public static void addByteArrayEntity(HttpEntityEnclosingRequestBase requestBase, byte[] b) { requestBase.setEntity(new ByteArrayEntity(b)); }
From source file:org.dasein.cloud.azure.AzureStorageMethod.java
@SuppressWarnings("deprecation") public Document getAsDoc(@Nonnull String httpVerb, @Nonnull String resource, @Nullable Map<String, String> queries, @Nullable String body, @Nullable Map<String, String> headerMap, boolean authorization) throws CloudException, InternalException { if (logger.isTraceEnabled()) { logger.trace("enter - " + AzureStorageMethod.class.getName() + "." + httpVerb + "(" + getStorageAccount() + "," + resource + ")"); }//ww w .j a v a2 s . c o m String endpoint = getStorageEnpoint(); if (wire.isDebugEnabled()) { wire.debug(httpVerb + "--------------------------------------------------------> " + endpoint + getStorageAccount() + resource); wire.debug(""); } try { HttpClient client = getClient(); if (headerMap == null) { headerMap = new HashMap<String, String>(); } HttpRequestBase method = getMethod(httpVerb, buildUrl(resource, queries), queries, headerMap, authorization); if (wire.isDebugEnabled()) { wire.debug(method.getRequestLine().toString()); for (Header header : method.getAllHeaders()) { wire.debug(header.getName() + ": " + header.getValue()); } wire.debug(""); if (body != null) { wire.debug(body); wire.debug(""); } } // If it is post or put if (method instanceof HttpEntityEnclosingRequestBase) { HttpEntityEnclosingRequestBase entityEnclosingMethod = (HttpEntityEnclosingRequestBase) method; if (body != null) { entityEnclosingMethod.setEntity(new StringEntity(body, "application/xml", "utf-8")); } } HttpResponse response; StatusLine status; try { response = client.execute(method); status = response.getStatusLine(); } catch (IOException e) { logger.error("GET(): Failed to execute HTTP request due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } if (logger.isDebugEnabled()) { logger.debug("GET(): HTTP Status " + status); } Header[] headers = response.getAllHeaders(); if (wire.isDebugEnabled()) { wire.debug(status.toString()); for (Header h : headers) { if (h.getValue() != null) { wire.debug(h.getName() + ": " + h.getValue().trim()); } else { wire.debug(h.getName() + ":"); } } wire.debug(""); } if (status.getStatusCode() == HttpServletResponse.SC_NOT_FOUND) { return null; } if (status.getStatusCode() != HttpServletResponse.SC_OK && status.getStatusCode() != HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION) { logger.error( httpVerb + "(): Expected OK for " + httpVerb + "request, got " + status.getStatusCode()); HttpEntity entity = response.getEntity(); String result; if (entity == null) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), "An error was returned without explanation"); } try { result = EntityUtils.toString(entity); } catch (IOException e) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), e.getMessage()); } if (wire.isDebugEnabled()) { wire.debug(result); } wire.debug(""); AzureException.ExceptionItems items = AzureException.parseException(status.getStatusCode(), result); if (items == null) { return null; } logger.error( httpVerb + "(): [" + status.getStatusCode() + " : " + items.message + "] " + items.details); throw new AzureException(items); } else { HttpEntity entity = response.getEntity(); if (entity == null) { return null; } InputStream input; try { input = entity.getContent(); } catch (IOException e) { logger.error(httpVerb + "(): Failed to read response error due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } return parseResponse(input, true); } } catch (UnsupportedEncodingException e) { throw new CloudException(e); } finally { if (logger.isTraceEnabled()) { logger.trace("exit - " + AzureMethod.class.getName() + ".getStream()"); } if (wire.isDebugEnabled()) { wire.debug(""); wire.debug("--------------------------------------------------------> "); } } }
From source file:org.dasein.cloud.azure.AzureStorageMethod.java
public @Nullable InputStream getAsStream(@Nonnull String strMethod, @Nonnull String resource, @Nonnull Map<String, String> queries, @Nullable String body, @Nullable Map<String, String> headerMap, boolean authorization) throws CloudException, InternalException { if (logger.isTraceEnabled()) { logger.trace("enter - " + AzureStorageMethod.class.getName() + "." + strMethod + "(" + getStorageAccount() + "," + resource + ")"); }/*from ww w . j ava2 s.c om*/ String endpoint = getStorageEnpoint(); if (wire.isDebugEnabled()) { wire.debug(strMethod + "--------------------------------------------------------> " + endpoint + getStorageAccount() + resource); wire.debug(""); } try { HttpClient client = getClient(); String contentLength = null; if (body != null) { contentLength = String.valueOf(body.length()); } else { contentLength = "0"; } HttpRequestBase method = getMethod(strMethod, buildUrl(resource, queries), queries, headerMap, authorization); if (wire.isDebugEnabled()) { wire.debug(method.getRequestLine().toString()); for (Header header : method.getAllHeaders()) { wire.debug(header.getName() + ": " + header.getValue()); } wire.debug(""); if (body != null) { wire.debug(body); wire.debug(""); } } // If it is post or put if (method instanceof HttpEntityEnclosingRequestBase) { HttpEntityEnclosingRequestBase entityEnclosingMethod = (HttpEntityEnclosingRequestBase) method; if (body != null) { entityEnclosingMethod.setEntity(new StringEntity(body, "application/xml", "utf-8")); } } HttpResponse response; StatusLine status; try { response = client.execute(method); status = response.getStatusLine(); } catch (IOException e) { logger.error("post(): Failed to execute HTTP request due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } if (logger.isDebugEnabled()) { logger.debug("post(): HTTP Status " + status); } Header[] headers = response.getAllHeaders(); if (wire.isDebugEnabled()) { wire.debug(status.toString()); for (Header h : headers) { if (h.getValue() != null) { wire.debug(h.getName() + ": " + h.getValue().trim()); } else { wire.debug(h.getName() + ":"); } } wire.debug(""); } if (status.getStatusCode() == HttpServletResponse.SC_NOT_FOUND) { return null; } if (status.getStatusCode() != HttpServletResponse.SC_OK && status.getStatusCode() != HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION) { logger.error( strMethod + "(): Expected OK for " + strMethod + "request, got " + status.getStatusCode()); HttpEntity entity = response.getEntity(); String result; if (entity == null) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), "An error was returned without explanation"); } try { result = EntityUtils.toString(entity); } catch (IOException e) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), e.getMessage()); } if (wire.isDebugEnabled()) { wire.debug(result); } wire.debug(""); AzureException.ExceptionItems items = AzureException.parseException(status.getStatusCode(), result); if (items == null) { return null; } logger.error(strMethod + "(): [" + status.getStatusCode() + " : " + items.message + "] " + items.details); throw new AzureException(items); } else { HttpEntity entity = response.getEntity(); if (entity == null) { return null; } InputStream input; try { input = entity.getContent(); } catch (IOException e) { logger.error(strMethod + "(): Failed to read response error due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } return input; } } catch (UnsupportedEncodingException e) { throw new CloudException(e); } finally { if (logger.isTraceEnabled()) { logger.trace("exit - " + AzureMethod.class.getName() + ".getStream()"); } if (wire.isDebugEnabled()) { wire.debug(""); wire.debug("--------------------------------------------------------> "); } } }
From source file:org.dasein.cloud.azure.AzureStorageMethod.java
public String getBlobProperty(@Nonnull String strMethod, @Nonnull String resource, @Nonnull Map<String, String> queries, String body, @Nullable Map<String, String> headerMap, boolean authorization, String propertyName) throws CloudException, InternalException { if (logger.isTraceEnabled()) { logger.trace("enter - " + AzureStorageMethod.class.getName() + "." + strMethod + "(" + getStorageAccount() + "," + resource + ")"); }// w w w .ja v a 2s .c o m String endpoint = getStorageEnpoint(); if (wire.isDebugEnabled()) { wire.debug(strMethod + "--------------------------------------------------------> " + endpoint + getStorageAccount() + resource); wire.debug(""); } try { HttpClient client = getClient(); if (headerMap == null) { headerMap = new HashMap<String, String>(); } HttpRequestBase method = getMethod(strMethod, buildUrl(resource, queries), queries, headerMap, authorization); if (wire.isDebugEnabled()) { wire.debug(method.getRequestLine().toString()); for (Header header : method.getAllHeaders()) { wire.debug(header.getName() + ": " + header.getValue()); } wire.debug(""); if (body != null) { wire.debug(body); wire.debug(""); } } // If it is post or put if (method instanceof HttpEntityEnclosingRequestBase) { HttpEntityEnclosingRequestBase entityEnclosingMethod = (HttpEntityEnclosingRequestBase) method; if (body != null) { entityEnclosingMethod.setEntity(new StringEntity(body, "application/xml", "utf-8")); } } HttpResponse response; StatusLine status; try { response = client.execute(method); status = response.getStatusLine(); } catch (IOException e) { logger.error("post(): Failed to execute HTTP request due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } if (logger.isDebugEnabled()) { logger.debug("get(): HTTP Status " + status); } if (wire.isDebugEnabled()) { Header[] headers = response.getAllHeaders(); wire.debug(status.toString()); for (Header h : headers) { if (h.getValue() != null) { wire.debug(h.getName() + ": " + h.getValue().trim()); } else { wire.debug(h.getName() + ":"); } } wire.debug(""); } if (status.getStatusCode() == HttpServletResponse.SC_NOT_FOUND) { return null; } if ((status.getStatusCode() != HttpServletResponse.SC_CREATED && status.getStatusCode() != HttpServletResponse.SC_ACCEPTED && status.getStatusCode() != HttpServletResponse.SC_OK) && status.getStatusCode() != HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION) { logger.error( strMethod + "(): Expected OK for " + strMethod + "request, got " + status.getStatusCode()); HttpEntity entity = response.getEntity(); String result; if (entity == null) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), "An error was returned without explanation"); } try { result = EntityUtils.toString(entity); int index = result.indexOf("<"); // The result may not be a stardard xml format if (index > 0) { result = result.substring(index); } } catch (IOException e) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), e.getMessage()); } if (wire.isDebugEnabled()) { wire.debug(result); } wire.debug(""); AzureException.ExceptionItems items = AzureException.parseException(status.getStatusCode(), result); logger.error(strMethod + "(): [" + status.getStatusCode() + " : " + items.message + "] " + items.details); throw new AzureException(items); } else { Header header = response.getFirstHeader(propertyName); if (header != null) { return header.getValue(); } else { return null; } } } catch (UnsupportedEncodingException e) { throw new CloudException(e); } finally { if (logger.isTraceEnabled()) { logger.trace("exit - " + AzureMethod.class.getName() + ".getStream()"); } if (wire.isDebugEnabled()) { wire.debug(""); wire.debug("--------------------------------------------------------> "); } } }
From source file:org.dasein.cloud.azure.AzureStorageMethod.java
public void invoke(@Nonnull String strMethod, @Nonnull String resource, @Nonnull Map<String, String> queries, @Nullable String body, @Nullable Map<String, String> headerMap, boolean authorization) throws CloudException, InternalException { if (logger.isTraceEnabled()) { logger.trace("enter - " + AzureStorageMethod.class.getName() + "." + strMethod + "(" + getStorageAccount() + "," + resource + ")"); }/*from ww w . j a va2s .c o m*/ String endpoint = getStorageEnpoint(); if (wire.isDebugEnabled()) { wire.debug(strMethod + "--------------------------------------------------------> " + endpoint + getStorageAccount() + resource); wire.debug(""); } try { HttpClient client = getClient(); if (headerMap == null) { headerMap = new HashMap<String, String>(); } HttpRequestBase method = getMethod(strMethod, buildUrl(resource, queries), queries, headerMap, authorization); if (wire.isDebugEnabled()) { wire.debug(method.getRequestLine().toString()); for (Header header : method.getAllHeaders()) { wire.debug(header.getName() + ": " + header.getValue()); } wire.debug(""); if (body != null) { wire.debug(body); wire.debug(""); } } // If it is post or put if (method instanceof HttpEntityEnclosingRequestBase) { HttpEntityEnclosingRequestBase entityEnclosingMethod = (HttpEntityEnclosingRequestBase) method; if (body != null) { entityEnclosingMethod.setEntity(new StringEntity(body, "application/xml", "utf-8")); } } HttpResponse response; StatusLine status; try { response = client.execute(method); status = response.getStatusLine(); } catch (IOException e) { logger.error("post(): Failed to execute HTTP request due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } if (logger.isDebugEnabled()) { logger.debug("post(): HTTP Status " + status); } Header[] headers = response.getAllHeaders(); if (wire.isDebugEnabled()) { wire.debug(status.toString()); for (Header h : headers) { if (h.getValue() != null) { wire.debug(h.getName() + ": " + h.getValue().trim()); } else { wire.debug(h.getName() + ":"); } } wire.debug(""); } if ((status.getStatusCode() != HttpServletResponse.SC_CREATED && status.getStatusCode() != HttpServletResponse.SC_ACCEPTED && status.getStatusCode() != HttpServletResponse.SC_OK) && status.getStatusCode() != HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION) { logger.error( strMethod + "(): Expected OK for " + strMethod + "request, got " + status.getStatusCode()); HttpEntity entity = response.getEntity(); String result; if (entity == null) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), "An error was returned without explanation"); } try { result = EntityUtils.toString(entity); } catch (IOException e) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), e.getMessage()); } if (wire.isDebugEnabled()) { wire.debug(result); } wire.debug(""); AzureException.ExceptionItems items = AzureException.parseException(status.getStatusCode(), result); if (items != null) { logger.error(strMethod + "(): [" + status.getStatusCode() + " : " + items.message + "] " + items.details); throw new AzureException(items); } else { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), "UnknownError", result); } } } catch (UnsupportedEncodingException e) { throw new CloudException(e); } finally { if (logger.isTraceEnabled()) { logger.trace("exit - " + AzureMethod.class.getName() + ".getStream()"); } if (wire.isDebugEnabled()) { wire.debug(""); wire.debug("--------------------------------------------------------> "); } } }
From source file:org.dasein.cloud.azure.AzureStorageMethod.java
public void putWithFile(@Nonnull String strMethod, @Nonnull String resource, Map<String, String> queries, File file, Map<String, String> headerMap, boolean authorization) throws CloudException, InternalException { if (logger.isTraceEnabled()) { logger.trace("enter - " + AzureStorageMethod.class.getName() + "." + strMethod + "(" + getStorageAccount() + "," + resource + ")"); }//from w ww . j a v a 2 s . co m String endpoint = getStorageEnpoint(); if (wire.isDebugEnabled()) { wire.debug(strMethod + "--------------------------------------------------------> " + endpoint + getStorageAccount() + resource); wire.debug(""); } long begin = System.currentTimeMillis(); try { HttpClient client = getClient(); String contentLength = null; if (file != null) { contentLength = String.valueOf(file.length()); } else { contentLength = "0"; } HttpRequestBase method = getMethod(strMethod, buildUrl(resource, queries), queries, headerMap, authorization); if (wire.isDebugEnabled()) { wire.debug(method.getRequestLine().toString()); for (Header header : method.getAllHeaders()) { wire.debug(header.getName() + ": " + header.getValue()); } wire.debug(""); if (file != null) { wire.debug(file); wire.debug(""); } } // If it is post or put if (method instanceof HttpEntityEnclosingRequestBase) { HttpEntityEnclosingRequestBase entityEnclosingMethod = (HttpEntityEnclosingRequestBase) method; if (file != null) { entityEnclosingMethod.setEntity(new FileEntity(file, ContentType.APPLICATION_OCTET_STREAM)); } } HttpResponse response; StatusLine status; try { response = client.execute(method); status = response.getStatusLine(); } catch (IOException e) { logger.error("post(): Failed to execute HTTP request due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } long end = System.currentTimeMillis(); logger.debug("Totoal time -> " + (end - begin)); throw new CloudException(e); } if (logger.isDebugEnabled()) { logger.debug("post(): HTTP Status " + status); } Header[] headers = response.getAllHeaders(); if (wire.isDebugEnabled()) { wire.debug(status.toString()); for (Header h : headers) { if (h.getValue() != null) { wire.debug(h.getName() + ": " + h.getValue().trim()); } else { wire.debug(h.getName() + ":"); } } wire.debug(""); } if ((status.getStatusCode() != HttpServletResponse.SC_CREATED && status.getStatusCode() != HttpServletResponse.SC_ACCEPTED && status.getStatusCode() != HttpServletResponse.SC_OK) && status.getStatusCode() != HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION) { logger.error( strMethod + "(): Expected OK for " + strMethod + "request, got " + status.getStatusCode()); HttpEntity entity = response.getEntity(); String result; if (entity == null) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), "An error was returned without explanation"); } try { result = EntityUtils.toString(entity); } catch (IOException e) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), e.getMessage()); } if (wire.isDebugEnabled()) { wire.debug(result); } wire.debug(""); AzureException.ExceptionItems items = AzureException.parseException(status.getStatusCode(), result); logger.error(strMethod + "(): [" + status.getStatusCode() + " : " + items.message + "] " + items.details); throw new AzureException(items); } } finally { if (logger.isTraceEnabled()) { logger.trace("exit - " + AzureMethod.class.getName() + ".getStream()"); } if (wire.isDebugEnabled()) { wire.debug(""); wire.debug("--------------------------------------------------------> "); } } }
From source file:org.dasein.cloud.azure.AzureStorageMethod.java
public void putWithBytes(@Nonnull String strMethod, @Nonnull String resource, Map<String, String> queries, byte[] body, Map<String, String> headerMap, boolean authorization) throws CloudException, InternalException { if (logger.isTraceEnabled()) { logger.trace("enter - " + AzureStorageMethod.class.getName() + "." + strMethod + "(" + getStorageAccount() + "," + resource + ")"); }/*ww w.j av a 2 s. c o m*/ String endpoint = getStorageEnpoint(); if (wire.isDebugEnabled()) { wire.debug(strMethod + "--------------------------------------------------------> " + endpoint + getStorageAccount() + resource); wire.debug(""); } try { HttpClient client = getClient(); String contentLength = null; if (body != null) { contentLength = String.valueOf(body.length); } else { contentLength = "0"; } HttpRequestBase method = getMethod(strMethod, buildUrl(resource, queries), queries, headerMap, authorization); if (wire.isDebugEnabled()) { wire.debug(method.getRequestLine().toString()); for (Header header : method.getAllHeaders()) { wire.debug(header.getName() + ": " + header.getValue()); } wire.debug(""); if (body != null) { wire.debug(body); wire.debug(""); } } // If it is post or put if (method instanceof HttpEntityEnclosingRequestBase) { HttpEntityEnclosingRequestBase entityEnclosingMethod = (HttpEntityEnclosingRequestBase) method; if (body != null) { entityEnclosingMethod.setEntity(new ByteArrayEntity(body)); } } HttpResponse response; StatusLine status; try { response = client.execute(method); status = response.getStatusLine(); } catch (IOException e) { logger.error("post(): Failed to execute HTTP request due to a cloud I/O error: " + e.getMessage()); if (logger.isTraceEnabled()) { e.printStackTrace(); } throw new CloudException(e); } if (logger.isDebugEnabled()) { logger.debug("post(): HTTP Status " + status); } Header[] headers = response.getAllHeaders(); if (wire.isDebugEnabled()) { wire.debug(status.toString()); for (Header h : headers) { if (h.getValue() != null) { wire.debug(h.getName() + ": " + h.getValue().trim()); } else { wire.debug(h.getName() + ":"); } } wire.debug(""); } if ((status.getStatusCode() != HttpServletResponse.SC_CREATED && status.getStatusCode() != HttpServletResponse.SC_ACCEPTED && status.getStatusCode() != HttpServletResponse.SC_OK) && status.getStatusCode() != HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION) { logger.error( strMethod + "(): Expected OK for " + strMethod + "request, got " + status.getStatusCode()); HttpEntity entity = response.getEntity(); String result; if (entity == null) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), "An error was returned without explanation"); } try { result = EntityUtils.toString(entity); } catch (IOException e) { throw new AzureException(CloudErrorType.GENERAL, status.getStatusCode(), status.getReasonPhrase(), e.getMessage()); } if (wire.isDebugEnabled()) { wire.debug(result); } wire.debug(""); AzureException.ExceptionItems items = AzureException.parseException(status.getStatusCode(), result); logger.error(strMethod + "(): [" + status.getStatusCode() + " : " + items.message + "] " + items.details); throw new AzureException(items); } } finally { if (logger.isTraceEnabled()) { logger.trace("exit - " + AzureMethod.class.getName() + ".getStream()"); } if (wire.isDebugEnabled()) { wire.debug(""); wire.debug("--------------------------------------------------------> "); } } }
From source file:org.envirocar.app.dao.remote.BaseRemoteDAO.java
protected HttpResponse executePayloadRequest(HttpEntityEnclosingRequestBase request, FileWithMetadata content) throws NotConnectedException, UnauthorizedException, ResourceConflictException { FileEntity entity = new FileEntity(content.getFile(), "application/json"); if (content.isGzipped()) { entity.setContentEncoding("gzip"); }//from w ww . j av a 2 s . co m request.setEntity(entity); return executePayloadRequest(request); }
From source file:org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.java
private void sendDescriptor(HttpEntityEnclosingRequestBase request, String content) throws IOException { StringEntity stringEntity = new StringEntity(content, "UTF-8"); stringEntity.setContentType("application/vnd.org.jfrog.artifactory+json"); request.setEntity(stringEntity); log.info("Deploying build descriptor to: " + request.getURI().toString()); HttpResponse response = httpClient.getHttpClient().execute(request); StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() != HttpStatus.SC_NO_CONTENT) { HttpEntity responseEntity = response.getEntity(); throw new IOException("Failed to send build descriptor. Status code: " + statusLine.getStatusCode() + getMessageFromEntity(responseEntity)); }//from w ww .j a v a 2 s . com }