当前位置: 首页>>代码示例>>Java>>正文


Java DeleteMethod.setRequestHeader方法代码示例

本文整理汇总了Java中org.apache.commons.httpclient.methods.DeleteMethod.setRequestHeader方法的典型用法代码示例。如果您正苦于以下问题:Java DeleteMethod.setRequestHeader方法的具体用法?Java DeleteMethod.setRequestHeader怎么用?Java DeleteMethod.setRequestHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.httpclient.methods.DeleteMethod的用法示例。


在下文中一共展示了DeleteMethod.setRequestHeader方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: httpDelete

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
protected static DeleteMethod httpDelete(String path, String user, String pwd) throws IOException {
  LOG.info("Connecting to {}", url + path);
  HttpClient httpClient = new HttpClient();
  DeleteMethod deleteMethod = new DeleteMethod(url + path);
  deleteMethod.addRequestHeader("Origin", url);
  if (userAndPasswordAreNotBlank(user, pwd)) {
    deleteMethod.setRequestHeader("Cookie", "JSESSIONID="+ getCookie(user, pwd));
  }
  httpClient.executeMethod(deleteMethod);
  LOG.info("{} - {}", deleteMethod.getStatusCode(), deleteMethod.getStatusText());
  return deleteMethod;
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:13,代码来源:AbstractTestRestApi.java

示例2: delete

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
public void delete(IdProof assertion, String path) throws ServiceException {
	try {
		DeleteMethod method = new DeleteMethod(baseUrl + "/" + path);
		method.setRequestHeader(AuthenticationHeader.HEADER_NAME, AuthenticationHeader.encode(assertion));
		
		int result = httpClient.executeMethod(method);
		if (result != 200) {
			throw new ServiceException(result);
		}
	}
	catch (IOException ex) {
		throw new ServiceFailure(ex);
	}
}
 
开发者ID:mosscode,项目名称:bdbadmin,代码行数:15,代码来源:BdbClient.java

示例3: deleteUserKernelAsOpsUser

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
@Test
public void deleteUserKernelAsOpsUser() throws HttpException, IOException {
	// setup
	DeleteMethod req = new DeleteMethod(KERNELS_URI + "/" + DUMMY_KERNEL_ID);
	req.setRequestHeader("accept", MediaType.APPLICATION_JSON);

	// assert
	assertEquals(200, opsUserHttpClient.executeMethod(req));
	assertContains("ok", req.getResponseBodyAsString());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:11,代码来源:UserKernelsAndRamdisksIntegrationTest.java

示例4: failToDeleteUserKernelAsMisUser

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
@Test
public void failToDeleteUserKernelAsMisUser() throws HttpException, IOException {
	// setup
	DeleteMethod req = new DeleteMethod(KERNELS_URI + "/kmi-1234");
	req.setRequestHeader("accept", MediaType.APPLICATION_JSON);

	// assert
	assertEquals(403, misUserHttpClient.executeMethod(req));
}
 
开发者ID:barnyard,项目名称:pi,代码行数:10,代码来源:UserKernelsAndRamdisksIntegrationTest.java

示例5: failToDeleteUserKernelAsProvisioningUser

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
@Test
public void failToDeleteUserKernelAsProvisioningUser() throws HttpException, IOException {
	// setup
	DeleteMethod req = new DeleteMethod(KERNELS_URI + "/kmi-1234");
	req.setRequestHeader("accept", MediaType.APPLICATION_JSON);

	// assert
	assertEquals(403, provisioningUserHttpClient.executeMethod(req));
}
 
开发者ID:barnyard,项目名称:pi,代码行数:10,代码来源:UserKernelsAndRamdisksIntegrationTest.java

示例6: deleteUserRamdiskAsOpsUser

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
@Test
public void deleteUserRamdiskAsOpsUser() throws HttpException, IOException {
	// setup
	DeleteMethod req = new DeleteMethod(RAMDISKS_URI + "/" + DUMMY_RAMDISK_ID);
	req.setRequestHeader("accept", MediaType.APPLICATION_JSON);

	// assert
	assertEquals(200, opsUserHttpClient.executeMethod(req));
	assertContains("ok", req.getResponseBodyAsString());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:11,代码来源:UserKernelsAndRamdisksIntegrationTest.java

示例7: failToDeleteUserRamdiskAsMisUser

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
@Test
public void failToDeleteUserRamdiskAsMisUser() throws HttpException, IOException {
	// setup
	DeleteMethod req = new DeleteMethod(RAMDISKS_URI + "/rmi-1234");
	req.setRequestHeader("accept", MediaType.APPLICATION_JSON);

	// assert
	assertEquals(403, misUserHttpClient.executeMethod(req));
}
 
开发者ID:barnyard,项目名称:pi,代码行数:10,代码来源:UserKernelsAndRamdisksIntegrationTest.java

示例8: failToDeleteUserRamdiskAsProvisioningUser

import org.apache.commons.httpclient.methods.DeleteMethod; //导入方法依赖的package包/类
@Test
public void failToDeleteUserRamdiskAsProvisioningUser() throws HttpException, IOException {
	// setup
	DeleteMethod req = new DeleteMethod(RAMDISKS_URI + "/rmi-1234");
	req.setRequestHeader("accept", MediaType.APPLICATION_JSON);

	// assert
	assertEquals(403, provisioningUserHttpClient.executeMethod(req));
}
 
开发者ID:barnyard,项目名称:pi,代码行数:10,代码来源:UserKernelsAndRamdisksIntegrationTest.java


注:本文中的org.apache.commons.httpclient.methods.DeleteMethod.setRequestHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。