Search in sources :

Example 76 with DELETE

use of javax.ws.rs.DELETE in project oxTrust by GluuFederation.

the class UserWebService method deleteUser.

@Path("{id}")
@DELETE
@Produces({ MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT, MediaType.APPLICATION_JSON + UTF8_CHARSET_FRAGMENT })
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@ProtectedApi
@ApiOperation(value = "Delete User", notes = "Delete User (https://tools.ietf.org/html/rfc7644#section-3.6)")
public Response deleteUser(@PathParam("id") String id) {
    Response response;
    try {
        log.debug("Executing web service method. deleteUser");
        // person cannot be null (check associated decorator method)
        GluuCustomPerson person = personService.getPersonByInum(id);
        scim2UserService.deleteUser(person);
        response = Response.noContent().build();
    } catch (Exception e) {
        log.error("Failure at deleteUser method", e);
        response = getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
    }
    return response;
}
Also used : ListResponse(org.gluu.oxtrust.model.scim2.ListResponse) Response(javax.ws.rs.core.Response) ListViewResponse(org.gluu.persist.model.ListViewResponse) GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) SCIMException(org.gluu.oxtrust.model.exception.SCIMException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) Path(javax.ws.rs.Path) DefaultValue(javax.ws.rs.DefaultValue) DELETE(javax.ws.rs.DELETE) HeaderParam(javax.ws.rs.HeaderParam) Produces(javax.ws.rs.Produces) ApiOperation(com.wordnik.swagger.annotations.ApiOperation) ProtectedApi(org.gluu.oxtrust.service.filter.ProtectedApi)

Example 77 with DELETE

use of javax.ws.rs.DELETE in project cxf by apache.

the class BookCatalog method delete.

@DELETE
public Response delete() throws IOException {
    final IndexWriter writer = getIndexWriter();
    try {
        writer.deleteAll();
        writer.commit();
    } finally {
        writer.close();
    }
    return Response.ok().build();
}
Also used : IndexWriter(org.apache.lucene.index.IndexWriter) DELETE(javax.ws.rs.DELETE)

Example 78 with DELETE

use of javax.ws.rs.DELETE in project cxf by apache.

the class BookStore method deleteBook.

@DELETE
@Path("/books/{bookId}/")
public Response deleteBook(@PathParam("bookId") String id) {
    Book b = books.get(Long.parseLong(id));
    Response r;
    if (b != null) {
        r = Response.ok().build();
    } else {
        r = Response.notModified().build();
    }
    return r;
}
Also used : Response(javax.ws.rs.core.Response) StreamingResponse(org.apache.cxf.jaxrs.ext.StreamingResponse) HttpServletResponse(javax.servlet.http.HttpServletResponse) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 79 with DELETE

use of javax.ws.rs.DELETE in project cxf by apache.

the class BookStore method deleteWithQuery.

@DELETE
@Path("/books/id")
public Response deleteWithQuery(@QueryParam("value") @DefaultValue("-1") int id) {
    if (id != 123) {
        throw new WebApplicationException();
    }
    Book b = books.get(new Long(id));
    Response r;
    if (b != null) {
        r = Response.ok().build();
    } else {
        r = Response.notModified().build();
    }
    return r;
}
Also used : Response(javax.ws.rs.core.Response) StreamingResponse(org.apache.cxf.jaxrs.ext.StreamingResponse) HttpServletResponse(javax.servlet.http.HttpServletResponse) WebApplicationException(javax.ws.rs.WebApplicationException) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 80 with DELETE

use of javax.ws.rs.DELETE in project cxf by apache.

the class Catalog method delete.

@DELETE
public Response delete() throws IOException {
    final IndexWriter writer = getIndexWriter();
    try {
        storage.deleteAll();
        writer.deleteAll();
        writer.commit();
    } finally {
        writer.close();
    }
    return Response.ok().build();
}
Also used : IndexWriter(org.apache.lucene.index.IndexWriter) DELETE(javax.ws.rs.DELETE)

Aggregations

DELETE (javax.ws.rs.DELETE)587 Path (javax.ws.rs.Path)539 Produces (javax.ws.rs.Produces)194 ApiOperation (io.swagger.annotations.ApiOperation)153 ApiResponses (io.swagger.annotations.ApiResponses)127 Consumes (javax.ws.rs.Consumes)78 Timed (com.codahale.metrics.annotation.Timed)59 Response (javax.ws.rs.core.Response)54 IOException (java.io.IOException)47 WebApplicationException (javax.ws.rs.WebApplicationException)46 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)42 Identity (org.olat.core.id.Identity)36 AuditEvent (org.graylog2.audit.jersey.AuditEvent)32 NotFoundException (javax.ws.rs.NotFoundException)23 POST (javax.ws.rs.POST)21 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)20 ApiResponse (io.swagger.annotations.ApiResponse)20 RestSecurityHelper.getIdentity (org.olat.restapi.security.RestSecurityHelper.getIdentity)20 HashMap (java.util.HashMap)19 GET (javax.ws.rs.GET)19