Search in sources :

Example 71 with HttpDelete

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
        }
    }
}
Also used : Group(org.activiti.engine.identity.Group) User(org.activiti.engine.identity.User) HttpDelete(org.apache.http.client.methods.HttpDelete) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse)

Example 72 with HttpDelete

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);
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete)

Example 73 with HttpDelete

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));
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete) HttpResponse(org.apache.http.HttpResponse) Test(org.junit.Test)

Example 74 with HttpDelete

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);
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete)

Example 75 with HttpDelete

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);
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete)

Aggregations

HttpDelete (org.apache.http.client.methods.HttpDelete)108 HttpResponse (org.apache.http.HttpResponse)25 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)22 Test (org.junit.Test)21 HttpGet (org.apache.http.client.methods.HttpGet)16 HttpPut (org.apache.http.client.methods.HttpPut)16 HttpPost (org.apache.http.client.methods.HttpPost)15 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)14 IOException (java.io.IOException)12 Deployment (org.activiti.engine.test.Deployment)12 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)11 Task (org.activiti.engine.task.Task)9 StringEntity (org.apache.http.entity.StringEntity)9 URI (java.net.URI)7 RequestExecutor (org.apache.stanbol.commons.testing.http.RequestExecutor)7 URISyntaxException (java.net.URISyntaxException)6 Header (org.apache.http.Header)6 HttpEntity (org.apache.http.HttpEntity)6 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)6 User (org.activiti.engine.identity.User)5