List of usage examples for org.apache.http.client.methods HttpDelete HttpDelete
public HttpDelete(final String uri)
From source file:com.sciamlab.util.HTTPClient.java
public String doDELETE(String url, Map<String, String> headerParams) throws ClientProtocolException, IOException { HttpDelete delete = new HttpDelete(url); for (String param : headerParams.keySet()) { String value = headerParams.get(param); delete.setHeader(param, value);/*from w ww .j ava 2 s. c o m*/ } HttpResponse response = client.execute(delete); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); String line = ""; String out = ""; while ((line = rd.readLine()) != null) { out += line; } return out; }
From source file:com.activiti.service.activiti.DeploymentService.java
public void deleteDeployment(ServerConfig serverConfig, HttpServletResponse httpResponse, String appDeploymentId) { HttpDelete delete = new HttpDelete(clientUtil.getServerUrl(serverConfig, clientUtil.createUriBuilder("repository/deployments/" + appDeploymentId))); clientUtil.execute(delete, httpResponse, serverConfig); }
From source file:org.activiti.rest.service.api.identity.UserResourceTest.java
/** * Test deleting a single user.//from www .ja va 2 s .co m */ public void testDeleteUser() throws Exception { User savedUser = null; try { User newUser = identityService.newUser("testuser"); newUser.setFirstName("Fred"); newUser.setLastName("McDonald"); newUser.setEmail("no-reply@activiti.org"); identityService.saveUser(newUser); savedUser = newUser; closeResponse(executeRequest( new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_USER, newUser.getId())), HttpStatus.SC_NO_CONTENT)); // Check if user is deleted assertEquals(0, identityService.createUserQuery().userId(newUser.getId()).count()); savedUser = null; } finally { // Delete user after test fails if (savedUser != null) { identityService.deleteUser(savedUser.getId()); } } }
From source file:org.activiti.rest.dmn.service.api.repository.DmnDeploymentResourceTest.java
/** * Test deleting a single deployment. DELETE dmn-repository/deployments/{deploymentId} *//* w w w. j ava 2s.c om*/ @DmnDeploymentAnnotation(resources = { "org/activiti/rest/dmn/service/api/repository/simple.dmn" }) public void testDeleteDeployment() throws Exception { dmnRepositoryService.createDeploymentQuery().singleResult(); DmnDeployment existingDeployment = dmnRepositoryService.createDeploymentQuery().singleResult(); assertNotNull(existingDeployment); // Delete the deployment HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + DmnRestUrls.createRelativeResourceUrl(DmnRestUrls.URL_DEPLOYMENT, existingDeployment.getId())); CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT); closeResponse(response); existingDeployment = dmnRepositoryService.createDeploymentQuery().singleResult(); assertNull(existingDeployment); }
From source file:org.flowable.rest.dmn.service.api.repository.DmnDeploymentResourceTest.java
/** * Test deleting a single deployment. DELETE dmn-repository/deployments/{deploymentId} *//*from www . ja va2 s .c om*/ @DmnDeploymentAnnotation(resources = { "org/flowable/rest/dmn/service/api/repository/simple.dmn" }) public void testDeleteDeployment() throws Exception { dmnRepositoryService.createDeploymentQuery().singleResult(); DmnDeployment existingDeployment = dmnRepositoryService.createDeploymentQuery().singleResult(); assertNotNull(existingDeployment); // Delete the deployment HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + DmnRestUrls.createRelativeResourceUrl(DmnRestUrls.URL_DEPLOYMENT, existingDeployment.getId())); CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT); closeResponse(response); existingDeployment = dmnRepositoryService.createDeploymentQuery().singleResult(); assertNull(existingDeployment); }
From source file:com.sap.dirigible.runtime.scripting.HttpUtils.java
public HttpDelete createDelete(String strURL) { return new HttpDelete(strURL); }
From source file:com.facebook.presto.jdbc.ApacheQueryHttpClient.java
@Override public void deleteAsync(URI uri) { HttpDelete request = new HttpDelete(uri); request.setHeader(USER_AGENT, userAgent); request.setConfig(requestConfig);/*from www . j a v a2s . c o m*/ httpAsyncClient.execute(request, null); }
From source file:com.arcbees.vcs.bitbucket.BitbucketApi.java
@Override public void deleteComment(Integer pullRequestId, Long commentId) throws IOException { String requestUrl = apiPaths.deleteComment(repositoryOwner, repositoryName, pullRequestId, commentId); HttpDelete request = new HttpDelete(requestUrl); executeRequest(httpClient, request, credentials); }
From source file:com.example.aab119.restclientexample.RestClient.java
public void execute(RequestMethod method) throws Exception { switch (method) { case GET: {//from w w w . j av a 2 s . c o m HttpGet request = new HttpGet(url + addGetParams()); request = (HttpGet) addHeaderParams(request); executeRequest(request, url); break; } case POST: { HttpPost request = new HttpPost(url); request = (HttpPost) addHeaderParams(request); request = (HttpPost) addBodyParams(request); executeRequest(request, url); break; } case PUT: { HttpPut request = new HttpPut(url); request = (HttpPut) addHeaderParams(request); request = (HttpPut) addBodyParams(request); executeRequest(request, url); break; } case DELETE: { HttpDelete request = new HttpDelete(url); request = (HttpDelete) addHeaderParams(request); executeRequest(request, url); } } }
From source file:org.activiti.rest.service.api.identity.GroupResourceTest.java
/** * Test deleting a single group./*from w w w .j a va 2 s . co m*/ */ public void testDeleteGroup() throws Exception { try { Group testGroup = identityService.newGroup("testgroup"); testGroup.setName("Test group"); testGroup.setType("Test type"); identityService.saveGroup(testGroup); closeResponse(executeRequest( new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP, "testgroup")), HttpStatus.SC_NO_CONTENT)); assertNull(identityService.createGroupQuery().groupId("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 } } }