use of org.apache.http.client.methods.HttpDelete in project Activiti by Activiti.
the class GroupMembershipResourceTest method testDeleteMembership.
public void testDeleteMembership() throws Exception {
try {
Group testGroup = identityService.newGroup("testgroup");
testGroup.setName("Test group");
testGroup.setType("Test type");
identityService.saveGroup(testGroup);
User testUser = identityService.newUser("testuser");
identityService.saveUser(testUser);
identityService.createMembership("testuser", "testgroup");
HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_MEMBERSHIP, "testgroup", "testuser"));
CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT);
closeResponse(response);
// Check if membership is actually deleted
assertNull(identityService.createUserQuery().memberOfGroup("testgroup").singleResult());
} finally {
try {
identityService.deleteGroup("testgroup");
} catch (Throwable ignore) {
// Ignore, since the group may not have been created in the test
// or already deleted
}
try {
identityService.deleteUser("testuser");
} catch (Throwable ignore) {
// Ignore, since the group may not have been created in the test
// or already deleted
}
}
}
use of org.apache.http.client.methods.HttpDelete in project afinal by yangfuhai.
the class FinalHttp method delete.
public void delete(String url, Header[] headers, AjaxCallBack<? extends Object> callBack) {
final HttpDelete delete = new HttpDelete(url);
if (headers != null)
delete.setHeaders(headers);
sendRequest(httpClient, httpContext, delete, null, callBack);
}
use of org.apache.http.client.methods.HttpDelete in project wildfly by wildfly.
the class DenyUncoveredHttpMethodsTestCase method testDeleteMethod.
@Test
public void testDeleteMethod() throws Exception {
HttpDelete httpDelete = new HttpDelete(getURL());
HttpResponse response = getHttpResponse(httpDelete);
assertThat(statusCodeOf(response), is(HttpServletResponse.SC_FORBIDDEN));
}
use of org.apache.http.client.methods.HttpDelete in project ThinkAndroid by white-cat.
the class AsyncHttpClient method delete.
/**
* Perform a HTTP DELETE 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 responseHandler
* the response handler instance that should handle the response.
*/
public void delete(Context context, String url, Header[] headers, AsyncHttpResponseHandler responseHandler) {
final HttpDelete delete = new HttpDelete(url);
if (headers != null)
delete.setHeaders(headers);
sendRequest(httpClient, httpContext, delete, null, responseHandler, context);
}
use of org.apache.http.client.methods.HttpDelete in project ThinkAndroid by white-cat.
the class AsyncHttpClient method delete.
/**
* Perform a HTTP DELETE request.
*
* @param context
* the Android Context which initiated the request.
* @param url
* the URL to send the request to.
* @param responseHandler
* the response handler instance that should handle the response.
*/
public void delete(Context context, String url, AsyncHttpResponseHandler responseHandler) {
final HttpDelete delete = new HttpDelete(url);
sendRequest(httpClient, httpContext, delete, null, responseHandler, context);
}
Aggregations