Search in sources :

Example 1 with UploadEntity

use of com.lidroid.xutils.http.client.entity.UploadEntity in project xUtils by wyouflf.

the class HttpRequest method setRequestParams.

public void setRequestParams(RequestParams param, RequestCallBackHandler callBackHandler) {
    if (param != null) {
        if (uriCharset == null) {
            uriCharset = Charset.forName(param.getCharset());
        }
        List<RequestParams.HeaderItem> headerItems = param.getHeaders();
        if (headerItems != null) {
            for (RequestParams.HeaderItem headerItem : headerItems) {
                if (headerItem.overwrite) {
                    this.setHeader(headerItem.header);
                } else {
                    this.addHeader(headerItem.header);
                }
            }
        }
        this.addQueryStringParams(param.getQueryStringParams());
        HttpEntity entity = param.getEntity();
        if (entity != null) {
            if (entity instanceof UploadEntity) {
                ((UploadEntity) entity).setCallBackHandler(callBackHandler);
            }
            this.setEntity(entity);
        }
    }
}
Also used : UploadEntity(com.lidroid.xutils.http.client.entity.UploadEntity) HttpEntity(org.apache.http.HttpEntity) RequestParams(com.lidroid.xutils.http.RequestParams)

Aggregations

RequestParams (com.lidroid.xutils.http.RequestParams)1 UploadEntity (com.lidroid.xutils.http.client.entity.UploadEntity)1 HttpEntity (org.apache.http.HttpEntity)1