List of usage examples for org.apache.http.client.methods HttpRequestBase removeHeader
public void removeHeader(Header header)
From source file:com.ibm.sbt.services.endpoints.ConnectionsEndpointAdapter.java
private void updateNonceHeader(HttpRequestBase method, String nonce) { Header header = findHeader(method, X_UPDATE_NONCE); if (header != null) { method.removeHeader(header); }/*from w w w .j a va2s . c om*/ method.addHeader(X_UPDATE_NONCE, nonce); }
From source file:org.openlmis.UiUtils.HttpClient.java
private void prepareRequestHeaderAndEntity(String commMethod, String json, HttpRequestBase httpRequest, boolean headerRequired) throws UnsupportedEncodingException { if (commMethod.equals(GET)) return;//from w w w . j a v a 2 s . co m httpRequest.setHeader(new BasicHeader("Content-Type", "application/json;charset=UTF-8")); ((HttpEntityEnclosingRequestBase) httpRequest).setEntity(new StringEntity(json)); if (!headerRequired) { Header[] headers = httpRequest.getAllHeaders(); for (Header h : headers) { httpRequest.removeHeader(h); } } }