org.apache.http.client.methods.HttpEntityEnclosingRequestBase#setHeaders()源码实例Demo

下面列出了org.apache.http.client.methods.HttpEntityEnclosingRequestBase#setHeaders() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: letv   文件: AsyncHttpClient.java
public void post(Context context, String url, Header[] headers, RequestParams params, String contentType, AsyncHttpResponseHandler responseHandler) {
    HttpEntityEnclosingRequestBase request = new HttpPost(url);
    if (params != null) {
        request.setEntity(paramsToEntity(params));
    }
    if (headers != null) {
        request.setHeaders(headers);
    }
    sendRequest(this.httpClient, this.httpContext, request, contentType, responseHandler, context);
}
 
源代码2 项目: letv   文件: AsyncHttpClient.java
public void put(Context context, String url, Header[] headers, HttpEntity entity, String contentType, AsyncHttpResponseHandler responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if (headers != null) {
        request.setHeaders(headers);
    }
    sendRequest(this.httpClient, this.httpContext, request, contentType, responseHandler, context);
}
 
源代码3 项目: MiBandDecompiled   文件: AsyncHttpClient.java
public RequestHandle put(Context context, String s, Header aheader[], HttpEntity httpentity, String s1, ResponseHandlerInterface responsehandlerinterface)
{
    HttpEntityEnclosingRequestBase httpentityenclosingrequestbase = a(new HttpPut(URI.create(s).normalize()), httpentity);
    if (aheader != null)
    {
        httpentityenclosingrequestbase.setHeaders(aheader);
    }
    return sendRequest(c, d, httpentityenclosingrequestbase, s1, responsehandlerinterface, context);
}
 
源代码4 项目: Android-Basics-Codes   文件: FinalHttp.java
public Object putSync(String url,Header[] headers, HttpEntity entity, String contentType) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if(headers != null) request.setHeaders(headers);
    return sendSyncRequest(httpClient, httpContext, request, contentType);
}
 
源代码5 项目: Android-Basics-Codes   文件: FinalHttp.java
public void put(String url,Header[] headers, HttpEntity entity, String contentType, AjaxCallBack<? extends Object> callBack) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if(headers != null) request.setHeaders(headers);
    sendRequest(httpClient, httpContext, request, contentType, callBack);
}
 
源代码6 项目: Android-Basics-Codes   文件: FinalHttp.java
public void post( String url, Header[] headers, HttpEntity entity, String contentType,AjaxCallBack<? extends Object> callBack) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
    if(headers != null) request.setHeaders(headers);
    sendRequest(httpClient, httpContext, request, contentType, callBack);
}
 
源代码7 项目: Android-Basics-Codes   文件: FinalHttp.java
public Object postSync( String url, Header[] headers, HttpEntity entity, String contentType) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
    if(headers != null) request.setHeaders(headers);
    return sendSyncRequest(httpClient, httpContext, request, contentType);
}
 
源代码8 项目: AndroidWear-OpenWear   文件: AsyncHttpClient.java
/**
 * Perform a HTTP POST request and track the Android Context which initiated
 * the request. Set headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param params          additional POST parameters to send with the request.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, RequestParams params, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = new HttpPost(getURI(url));
    if (params != null)
        request.setEntity(paramsToEntity(params, responseHandler));
    if (headers != null)
        request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码9 项目: AndroidWear-OpenWear   文件: AsyncHttpClient.java
/**
 * Perform a HTTP POST request and track the Android Context which initiated
 * the request. Set headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param entity          a data {@link HttpEntity} to send with the request, for
 *                        example, use this to send string/json/xml payloads to a server
 *                        by passing a {@link org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, HttpEntity entity, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(getURI(url)), entity);
    if (headers != null)
        request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码10 项目: Roid-Library   文件: AsyncHttpClient.java
/**
 * Perform a HTTP PUT request and track the Android Context which
 * initiated the request. And set one-time headers for the request
 * 
 * @param context the Android Context which initiated the request.
 * @param url the URL to send the request to.
 * @param headers set one-time headers for this request
 * @param entity a raw {@link HttpEntity} to send with the request, for
 *            example, use this to send string/json/xml payloads to a
 *            server by passing a
 *            {@link org.apache.http.entity.StringEntity}.
 * @param contentType the content type of the payload you are sending, for
 *            example application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle
 *            the response.
 */
public void put(Context context, String url, Header[] headers, HttpEntity entity, String contentType,
        AsyncHttpResponseHandler responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if (headers != null)
        request.setHeaders(headers);
    sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
/**
 * Perform a HTTP POST request and track the Android Context which initiated the request. Set
 * headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, HttpEntity entity, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码12 项目: Android-Basics-Codes   文件: AsyncHttpClient.java
/**
 * Perform a HTTP POST request and track the Android Context which initiated the request. Set
 * headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, HttpEntity entity, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(getURI(url)), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码13 项目: Android-Basics-Codes   文件: AsyncHttpClient.java
/**
 * Perform a HTTP POST request and track the Android Context which initiated the request. Set
 * headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, HttpEntity entity, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(getURI(url)), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码14 项目: Android-Basics-Codes   文件: AsyncHttpClient.java
/**
 * Perform a HTTP POST request and track the Android Context which initiated the request. Set
 * headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, HttpEntity entity, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(getURI(url)), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码15 项目: Android-Basics-Codes   文件: AsyncHttpClient.java
/**
 * Perform a HTTP PUT request and track the Android Context which initiated the request. And set
 * one-time headers for the request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set one-time headers for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle put(Context context, String url, Header[] headers, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(getURI(url)), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码16 项目: sealtalk-android   文件: SyncHttpClient.java
/**
 * Perform a HTTP POST request and track the Android Context which initiated
 * the request. Set headers only for this request
 *
 * @param context
 *            the Android Context which initiated the request.
 * @param url
 *            the URL to send the request to.
 * @param headers
 *            set headers only for this request
 * @param entity
 *            a raw {@link HttpEntity} to send with the request, for
 *            example, use this to send string/json/xml payloads to a server
 *            by passing a {@link StringEntity}.
 * @param contentType
 *            the content type of the payload you are sending, for example
 *            application/json if sending a json payload.
 * @return String
 * @throws HttpException 
 */
public String post(Context context, String url, Header[] headers, HttpEntity entity, String contentType) throws HttpException {
	HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
	if (headers != null) request.setHeaders(headers);
	return sendRequest(httpClient, httpContext, request, contentType, context);
}
 
/**
 * Perform a HTTP PUT request and track the Android Context which initiated the request. And set
 * one-time headers for the request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set one-time headers for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle put(Context context, String url, Header[] headers, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码18 项目: Android-Basics-Codes   文件: AsyncHttpClient.java
/**
 * Perform a HTTP PATCH request and track the Android Context which initiated the request. And set
 * one-time headers for the request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set one-time headers for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle patch(Context context, String url, Header[] headers, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPatch(getURI(url)), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码19 项目: android-project-wo2b   文件: AsyncHttpClient.java
/**
 * Perform a HTTP PUT request and track the Android Context which initiated the request. And set
 * one-time headers for the request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set one-time headers for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle put(Context context, String url, Header[] headers, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(URI.create(url).normalize()), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}
 
源代码20 项目: Android-Basics-Codes   文件: AsyncHttpClient.java
/**
 * Perform a HTTP PUT request and track the Android Context which initiated the request. And set
 * one-time headers for the request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set one-time headers for this request
 * @param entity          a raw {@link HttpEntity} to send with the request, for example, use
 *                        this to send string/json/xml payloads to a server by passing a {@link
 *                        org.apache.http.entity.StringEntity}.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending a json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle put(Context context, String url, Header[] headers, HttpEntity entity, String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(getURI(url)), entity);
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, responseHandler, context);
}