Example usage for org.apache.http.client.methods HttpPostHC4 addHeader

List of usage examples for org.apache.http.client.methods HttpPostHC4 addHeader

Introduction

In this page you can find the example usage for org.apache.http.client.methods HttpPostHC4 addHeader.

Prototype

public void addHeader(Header header) 

Source Link

Usage

From source file:com.tingtingapps.securesms.mms.OutgoingLegacyMmsConnection.java

private HttpUriRequest constructRequest(byte[] pduBytes, boolean useProxy) throws IOException {
    try {/*from  w  ww .j ava2  s .c o m*/
        HttpPostHC4 request = new HttpPostHC4(apn.getMmsc());
        for (Header header : getBaseHeaders()) {
            request.addHeader(header);
        }

        request.setEntity(new ByteArrayEntityHC4(pduBytes));
        if (useProxy) {
            HttpHost proxy = new HttpHost(apn.getProxy(), apn.getPort());
            request.setConfig(RequestConfig.custom().setProxy(proxy).build());
        }
        return request;
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae);
    }
}