本文整理汇总了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;
}
示例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);
}
}
示例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());
}
示例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));
}
示例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));
}
示例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());
}
示例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));
}
示例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));
}