本文整理汇总了Java中org.apache.http.client.methods.HttpEntityEnclosingRequestBase.setHeaders方法的典型用法代码示例。如果您正苦于以下问题:Java HttpEntityEnclosingRequestBase.setHeaders方法的具体用法?Java HttpEntityEnclosingRequestBase.setHeaders怎么用?Java HttpEntityEnclosingRequestBase.setHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.client.methods.HttpEntityEnclosingRequestBase
的用法示例。
在下文中一共展示了HttpEntityEnclosingRequestBase.setHeaders方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncPut
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
public String syncPut(String url, Header[] headers, HttpEntity entity, String contentType, String defaultEncoding)
throws ClientProtocolException, IOException {
HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
if (headers != null)
request.setHeaders(headers);
if (contentType != null) {
request.setHeader("Content-Type", contentType);
}
return parseResponse(syncExec(request), defaultEncoding);
}
示例2: post
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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);
}
示例3: post
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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(this.httpClient, this.httpContext, request, contentType,
responseHandler, context);
}
示例4: put
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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(this.httpClient, this.httpContext, request, contentType,
responseHandler, context);
}
示例5: patch
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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(this.httpClient, this.httpContext, request, contentType,
responseHandler, context);
}
示例6: syncPost
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
public String syncPost(String url, Header[] headers, HttpEntity entity, String contentType, String defaultEncoding)
throws ClientProtocolException, IOException {
HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
if (headers != null)
request.setHeaders(headers);
if (contentType != null) {
request.setHeader("Content-Type", contentType);
}
return parseResponse(syncExec(request), defaultEncoding);
}
示例7: postSync
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
public String postSync(String url, Header[] headers, RequestParams params,
String contentType) {
HttpEntityEnclosingRequestBase request = new HttpPost(generateUrl(url));
if (params != null)
request.setEntity(invokeParamsToEntity(params, new DefaultHttpResponseHandler()));
if (headers != null)
request.setHeaders(headers);
return sendSyncRequest(getHttpClient(), getHttpContext(), request,
contentType);
}
示例8: put
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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);
}
示例9: post
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
public RequestHandle post(Context context, String s, Header aheader[], HttpEntity httpentity, String s1, ResponseHandlerInterface responsehandlerinterface)
{
HttpEntityEnclosingRequestBase httpentityenclosingrequestbase = a(new HttpPost(URI.create(s).normalize()), httpentity);
if (aheader != null)
{
httpentityenclosingrequestbase.setHeaders(aheader);
}
return sendRequest(c, d, httpentityenclosingrequestbase, s1, responsehandlerinterface, context);
}
示例10: put
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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);
}
示例11: postSync
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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);
}
示例12: post
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
public <T> void post( String url, Header[] headers, AjaxParams params, String contentType,AjaxCallBack<T> callBack) {
HttpEntityEnclosingRequestBase request = new HttpPost(url);
if(params != null) request.setEntity(paramsToEntity(params));
if(headers != null) request.setHeaders(headers);
sendRequest(httpClient, httpContext, request, contentType, callBack);
}
示例13: putSync
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
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);
}
示例14: post
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
/**
* Perform getUrl 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 getUrl 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(URI.create(url).normalize());
if (params != null) request.setEntity(paramsToEntity(params, responseHandler));
if (headers != null) request.setHeaders(headers);
return sendRequest(httpClient, httpContext, request, contentType,
responseHandler, context);
}
示例15: post
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //导入方法依赖的package包/类
/**
* 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.
* @return String
* @throws HttpException
*/
public String post(Context context, String url, Header[] headers, RequestParams params, String contentType) throws HttpException {
HttpEntityEnclosingRequestBase request = new HttpPost(url);
if (params != null) request.setEntity(paramsToEntity(params));
if (headers != null) request.setHeaders(headers);
return sendRequest(httpClient, httpContext, request, contentType, context);
}