use of javax.ws.rs.DELETE in project fabric8 by jboss-fuse.
the class CustomerService method deleteCustomer.
@DELETE
@Path("/customers/{id}/")
public Response deleteCustomer(@PathParam("id") String id) {
long idNumber = Long.parseLong(id);
Customer c = customers.get(idNumber);
Response r;
if (c != null) {
r = Response.ok().build();
customers.remove(idNumber);
} else {
r = Response.notModified().build();
}
if (idNumber == currentId.get()) {
currentId.decrementAndGet();
}
return r;
}
use of javax.ws.rs.DELETE in project smarthome by eclipse.
the class ConfigurableServiceResource method deleteConfiguration.
@DELETE
@Path("/{serviceId}/config")
@Produces({ MediaType.APPLICATION_JSON })
@ApiOperation(value = "Deletes a service configuration for given service ID and returns the old configuration.")
@ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class), @ApiResponse(code = 204, message = "No old configuration"), @ApiResponse(code = 500, message = "Configuration can not be deleted due to internal error") })
public Response deleteConfiguration(@PathParam("serviceId") @ApiParam(value = "service ID", required = true) String serviceId) {
try {
Configuration oldConfiguration = configurationService.get(serviceId);
configurationService.delete(serviceId);
return oldConfiguration != null ? Response.ok(oldConfiguration).build() : Response.noContent().build();
} catch (IOException ex) {
logger.error("Cannot delete configuration for service {}: {}", serviceId, ex.getMessage(), ex);
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
}
use of javax.ws.rs.DELETE in project Singularity by HubSpot.
the class PriorityResource method deleteActivePriorityFreeze.
@DELETE
@Path("/freeze")
@ApiOperation("Stops the active priority freeze.")
@ApiResponses({ @ApiResponse(code = 202, message = "The active priority freeze was deleted."), @ApiResponse(code = 400, message = "There was no active priority freeze to delete.") })
public void deleteActivePriorityFreeze(@Auth SingularityUser user) {
authorizationHelper.checkAdminAuthorization(user);
final SingularityDeleteResult deleteResult = priorityManager.deleteActivePriorityFreeze();
checkBadRequest(deleteResult == SingularityDeleteResult.DELETED, "No active priority freeze to delete.");
priorityManager.clearPriorityKill();
}
use of javax.ws.rs.DELETE in project knox by apache.
the class TopologiesResource method deleteProviderConfiguration.
@DELETE
@Produces(APPLICATION_JSON)
@Path(SINGLE_PROVIDERCONFIG_API_PATH)
public Response deleteProviderConfiguration(@PathParam("name") String name) {
Response response;
GatewayServices services = (GatewayServices) request.getServletContext().getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
TopologyService ts = services.getService(GatewayServices.TOPOLOGY_SERVICE);
if (ts.deleteProviderConfiguration(name)) {
response = ok().entity("{ \"deleted\" : \"provider config " + name + "\" }").build();
} else {
response = notModified().build();
}
return response;
}
use of javax.ws.rs.DELETE in project fabric8 by jboss-fuse.
the class CustomerService method deleteCustomer.
/**
* This method is mapped to an HTTP DELETE of 'http://localhost:8181/cxf/crm/customerservice/customers/{id}'. The value for
* {id} will be passed to this message as a parameter, using the @PathParam annotation.
* <p/>
* The method uses the Response class to create the HTTP response: either HTTP Status 200/OK if the customer object was
* successfully removed from the local data map or a HTTP Status 304/Not Modified if it failed to remove the object.
*/
@com.wordnik.swagger.annotations.ApiOperation(value = "deleteCustomer", notes = "/** \n * This method is mapped to an HTTP DELETE of 'http://localhost:8181/cxf/crm/customerservice/customers/{id}'. The value for {id} will be passed to this message as a parameter, using the @PathParam annotation. <p/> The method uses the Response class to create the HTTP response: either HTTP Status 200/OK if the customer object was successfully removed from the local data map or a HTTP Status 304/Not Modified if it failed to remove the object.\n */\n")
@DELETE
@Path("/customers/{id}/")
public Response deleteCustomer(@com.wordnik.swagger.annotations.ApiParam(value = "id") @PathParam("id") String id) {
LOG.info("Invoking deleteCustomer, Customer id is: {}", id);
long idNumber = Long.parseLong(id);
Customer c = customers.get(idNumber);
Response r;
if (c != null) {
r = Response.ok().build();
customers.remove(idNumber);
} else {
r = Response.notModified().build();
}
return r;
}
Aggregations