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

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

Introduction

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

Prototype

public void addHeader(String str, String str2) 

Source Link

Usage

From source file:org.thoughtcrime.securesms.mms.IncomingMmsConnection.java

@Override
protected HttpUriRequest constructRequest(boolean useProxy) throws IOException {
    HttpGetHC4 request = new HttpGetHC4(apn.getMmsc());
    request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic");
    if (useProxy) {
        HttpHost proxy = new HttpHost(apn.getProxy(), apn.getPort());
        request.setConfig(RequestConfig.custom().setProxy(proxy).build());
    }/*from ww w . j  av  a2 s .c  o m*/
    return request;
}

From source file:at.bitfire.davdroid.webdav.WebDavResource.java

public void get(String acceptedMimeTypes) throws URISyntaxException, IOException, HttpException, DavException {
    HttpGetHC4 get = new HttpGetHC4(location);
    get.addHeader("Accept", acceptedMimeTypes);

    @Cleanup/* www .j a v a 2 s.c om*/
    CloseableHttpResponse response = httpClient.execute(get, context);
    checkResponse(response);

    HttpEntity entity = response.getEntity();
    if (entity == null)
        throw new DavNoContentException();

    properties.contentType = ContentType.get(entity);
    content = EntityUtilsHC4.toByteArray(entity);
}

From source file:com.granita.icloudcalsync.webdav.WebDavResource.java

public void get(String acceptedMimeTypes) throws URISyntaxException, IOException, HttpException, DavException {
    HttpGetHC4 get = new HttpGetHC4(location);
    get.addHeader("Accept", acceptedMimeTypes);

    @Cleanup//from w w w .  ja v a  2s.c om
    CloseableHttpResponse response = httpClient.execute(get, context);
    checkResponse(response);

    HttpEntity entity = response.getEntity();
    if (entity == null)
        throw new DavNoContentException();

    content = EntityUtilsHC4.toByteArray(entity);
}