本文整理汇总了Java中org.apache.http.client.methods.HttpDelete.addHeader方法的典型用法代码示例。如果您正苦于以下问题:Java HttpDelete.addHeader方法的具体用法?Java HttpDelete.addHeader怎么用?Java HttpDelete.addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.client.methods.HttpDelete
的用法示例。
在下文中一共展示了HttpDelete.addHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendHttpDelete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
@Override
public CloseableHttpResponse sendHttpDelete(String url, List<Header> headers) {
CloseableHttpResponse execute = null;
try {
LOGGER.info("Sending GET request to url-" + url);
CloseableHttpClient httpClient = this.httpClientFactory.getHttpClient();
HttpDelete httpDelete = new HttpDelete(url);
if (headers != null && !headers.isEmpty()) {
for (Header header : headers) {
httpDelete.addHeader(header);
}
}
execute = httpClient.execute(httpDelete);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Was unable to send Get request to url-" + url, e);
}
return execute;
}
示例2: doDelete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
@Override
public Response doDelete(final URL url, final Set<RequestHeader> headers) throws IOException {
final HttpDelete request = new HttpDelete(url.toString());
for(RequestHeader header : headers) {
if(header.getKey().equals(HTTP.TRANSFER_ENCODING)) {
continue;
}
if(header.getKey().equals(HTTP.CONTENT_LEN)) {
continue;
}
request.addHeader(new BasicHeader(header.getKey(), header.getValue()));
}
final CloseableHttpResponse response = client.execute(request);
return new CommonsHttpResponse(response);
}
示例3: deleteModule
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Deletes a module
*
* @param moduleName
* the name of the module to delete
* @param deleteCompletely
* if set to false, the module is only deleted from the current system and wil still exist in database
* @return request object to check status codes and return values
*/
public Response deleteModule( String moduleName, boolean deleteCompletely )
{
HttpDelete request = new HttpDelete(
this.yambasBase + "modules/" + moduleName + "?deleteCompletely=" + String.valueOf( deleteCompletely ) );
setAuthorizationHeader( request );
request.addHeader( "x-apiomat-system", this.system.toString( ) );
try
{
final HttpResponse response = this.client.execute( request );
return new Response( response );
}
catch ( final IOException e )
{
e.printStackTrace( );
}
return null;
}
示例4: deleteReference
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Delete the references for a specified object
*
* @param moduleName
* the name of the module
* @param dataModelName
* the name of the datamodel
* @param dataModelId
* the datamodel-id
* @param refAttributeName
* the attribute-name of the reference
* @param refId
* the reference id
* @return request object to check status codes and return values
*/
public Response deleteReference( String moduleName, String dataModelName, String dataModelId,
String refAttributeName, String refId )
{
final HttpDelete request = new HttpDelete( this.yambasBase + "apps/" + this.appName + "/models/" + moduleName +
"/" + dataModelName + "/" + dataModelId + "/" + refAttributeName + "/" + refId );
setAuthorizationHeader( request );
request.addHeader( "ContentType", "application/json" );
request.addHeader( "x-apiomat-apikey", this.apiKey );
request.addHeader( "x-apiomat-system", this.system.toString( ) );
try
{
final HttpResponse response = this.client.execute( request );
return new Response( response );
}
catch ( final IOException e )
{
e.printStackTrace( );
}
return null;
}
示例5: deleteObject
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Deletes an object
*
* @param moduleName
* the name of the module
* @param dataModelName
* the name of the datamodel
* @param dataModelId
* the datamodel-id
* @return request object to check status codes and return values
*/
public Response deleteObject( String moduleName, String dataModelName, String dataModelId )
{
final HttpDelete request = new HttpDelete( this.yambasBase + "apps/" + this.appName + "/models/" + moduleName +
"/" + dataModelName + "/" + dataModelId );
setAuthorizationHeader( request );
request.addHeader( "ContentType", "application/json" );
request.addHeader( "x-apiomat-apikey", this.apiKey );
request.addHeader( "x-apiomat-system", this.system.toString( ) );
try
{
final HttpResponse response = this.client.execute( request );
return new Response( response );
}
catch ( final IOException e )
{
e.printStackTrace( );
}
return null;
}
示例6: deleteStaticData
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Deletes static data, either image or file
*
* @param id the file id
* @param isImage indicates whether this is an image or a file
* @return request object to check status codes and return values
*/
public Response deleteStaticData( String id, final boolean isImage )
{
final HttpDelete request =
new HttpDelete(
this.yambasBase + "apps/" + this.appName + "/data/" + ( isImage ? "images/" : "files/" ) + id );
request.addHeader( "Content-Type", "application/octet-stream" );
request.addHeader( "x-apiomat-apikey", this.apiKey );
request.addHeader( "x-apiomat-system", this.system.toString( ) );
try
{
final HttpResponse response = this.client.execute( request );
return new Response( response );
}
catch ( final IOException e )
{
e.printStackTrace( );
}
return null;
}
示例7: doDelete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
示例8: createDelete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
public HttpDelete createDelete(String url, final List<NameValuePair> params, ApplicationType accept) throws IOException {
HttpDelete method = new HttpDelete(urlEncode(url, params));
if (null != accept) {
method.addHeader("accept", accept.val());
}
return method;
}
示例9: deleteElementRangeIndexTemporalAxis
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
public static void deleteElementRangeIndexTemporalAxis(String dbName, String axisName) throws Exception
{
DefaultHttpClient client = new DefaultHttpClient();
client.getCredentialsProvider().setCredentials(
new AuthScope(host, 8002),
new UsernamePasswordCredentials("admin", "admin"));
HttpDelete del = new HttpDelete("http://"+host+":8002/manage/v2/databases/"+ dbName + "/temporal/axes/" + axisName + "?format=json");
del.addHeader("Content-type", "application/json");
del.addHeader("accept", "application/json");
HttpResponse response = client.execute(del);
HttpEntity respEntity = response.getEntity();
if( response.getStatusLine().getStatusCode() == 400)
{
HttpEntity entity = response.getEntity();
String responseString = EntityUtils.toString(entity, "UTF-8");
System.out.println(responseString);
}
else if (respEntity != null) {
// EntityUtils to get the response content
String content = EntityUtils.toString(respEntity);
System.out.println(content);
}
else {
System.out.println("Axis: " + axisName + " deleted");
System.out.println("==============================================================");
}
}
示例10: deleteElementRangeIndexTemporalCollection
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
public static void deleteElementRangeIndexTemporalCollection(String dbName, String collectionName) throws Exception
{
DefaultHttpClient client = new DefaultHttpClient();
client.getCredentialsProvider().setCredentials(
new AuthScope(host, 8002),
new UsernamePasswordCredentials("admin", "admin"));
HttpDelete del = new HttpDelete("http://"+host+":8002/manage/v2/databases/"+ dbName + "/temporal/collections?collection=" + collectionName + "&format=json");
del.addHeader("Content-type", "application/json");
del.addHeader("accept", "application/json");
HttpResponse response = client.execute(del);
HttpEntity respEntity = response.getEntity();
if( response.getStatusLine().getStatusCode() == 400)
{
HttpEntity entity = response.getEntity();
String responseString = EntityUtils.toString(entity, "UTF-8");
System.out.println(responseString);
}
else if (respEntity != null) {
// EntityUtils to get the response content
String content = EntityUtils.toString(respEntity);
System.out.println(content);
}
else {
System.out.println("Collection: " + collectionName + " deleted");
System.out.println("==============================================================");
}
}
示例11: delAdmin
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Remove um administrador da conta digital
* @param email: E-mail do administrador à ser consultado
* @return boolean
*/
public boolean delAdmin(String email) throws IOException, PJBankException {
PJBankClient client = new PJBankClient(this.endPoint.concat("/administradores/").concat(email));
HttpDelete httpDelete = client.getHttpDeleteClient();
httpDelete.addHeader("x-chave-conta", this.chave);
return client.doRequest(httpDelete).getStatusLine().getStatusCode() == 200;
}
示例12: delTransaction
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Realiza o cancelamento de uma transação
* @param idTransacao: ID da transação à ser cancelada
* @return boolean
*/
public boolean delTransaction(String idTransacao) throws IOException, PJBankException {
PJBankClient client = new PJBankClient(this.endPoint.replace("{{credencial-conta}}", this.credencial).concat("/transacoes/").concat(idTransacao));
HttpDelete httpDelete = client.getHttpDeleteClient();
httpDelete.addHeader("x-chave-conta", this.chave);
return client.doRequest(httpDelete).getStatusLine().getStatusCode() == 200;
}
示例13: delete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Realiza o cancelamento de uma transação via cartão de crédito
* @param idTransacao: Código identificador da transação a ser cancelada
* @return boolean
*/
public boolean delete(String idTransacao)
throws IOException, ParseException, PJBankException {
if (StringUtils.isBlank(idTransacao))
throw new IllegalArgumentException("ID da transação não informado");
PJBankClient client = new PJBankClient(this.endPoint.concat("/transacoes/").concat(idTransacao));
HttpDelete httpDelete = client.getHttpDeleteClient();
httpDelete.addHeader("x-chave", this.getChave());
return client.doRequest(httpDelete).getStatusLine().getStatusCode() == 200;
}
示例14: doDelete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
示例15: httpDelete
import org.apache.http.client.methods.HttpDelete; //导入方法依赖的package包/类
/**
* HTTP DELETE
* @param host
* @param path
* @param connectTimeout
* @param headers
* @param querys
* @param signHeaderPrefixList
* @param appKey
* @param appSecret
* @return
* @throws Exception
*/
public static Response httpDelete(String host, String path, int connectTimeout, Map<String, String> headers, Map<String, String> querys, List<String> signHeaderPrefixList, String appKey, String appSecret)
throws Exception {
headers = initialBasicHeader(HttpMethod.DELETE, path, headers, querys, null, signHeaderPrefixList, appKey, appSecret);
HttpClient httpClient = wrapClient(host);
httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, getTimeout(connectTimeout));
HttpDelete delete = new HttpDelete(initUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
delete.addHeader(e.getKey(), MessageDigestUtil.utf8ToIso88591(e.getValue()));
}
return convert(httpClient.execute(delete));
}