Search in sources :

Example 81 with DELETE

use of javax.ws.rs.DELETE in project atlasmap by atlasmap.

the class AtlasService method removeMappingRequest.

@DELETE
@Path("/mapping/{mappingId}")
@Produces(MediaType.APPLICATION_JSON)
public Response removeMappingRequest(@PathParam("mappingId") String mappingId) {
    java.nio.file.Path mappingFilePath = Paths.get(baseFolder + File.separator + generateMappingFileName(mappingId));
    File mappingFile = mappingFilePath.toFile();
    if (!mappingFile.exists()) {
        return Response.noContent().build();
    }
    if (mappingFile != null && !mappingFile.delete()) {
        LOG.warn("Unable to delete mapping file " + mappingFile.toString());
    }
    return Response.ok().build();
}
Also used : File(java.io.File) Path(javax.ws.rs.Path) ApplicationPath(javax.ws.rs.ApplicationPath) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Example 82 with DELETE

use of javax.ws.rs.DELETE in project scheduling by ow2-proactive.

the class SchedulerStateRest method deleteLiveLogJob.

/**
 * remove the live log object.
 *
 * @param sessionId
 *            a valid session id
 * @param jobId
 *            the id of the job to retrieve
 * @throws NotConnectedRestException
 */
@Override
@DELETE
@Path("jobs/{jobid}/livelog")
@Produces("application/json")
public boolean deleteLiveLogJob(@HeaderParam("sessionid") String sessionId, @PathParam("jobid") String jobId) throws NotConnectedRestException {
    checkAccess(sessionId, "delete /scheduler/jobs/livelog" + jobId);
    Session ss = sessionStore.get(sessionId);
    ss.getJobsOutputController().removeAppender(jobId);
    return true;
}
Also used : HttpSession(javax.servlet.http.HttpSession) Session(org.ow2.proactive_grid_cloud_portal.common.Session) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Example 83 with DELETE

use of javax.ws.rs.DELETE in project mica2 by obiba.

the class CurrentSessionResource method deleteSession.

@DELETE
public Response deleteSession() {
    // Delete the Shiro session
    try {
        Session session = SecurityUtils.getSubject().getSession();
        Object cookieValue = session.getAttribute(HttpHeaders.SET_COOKIE);
        SecurityUtils.getSubject().logout();
        if (cookieValue != null) {
            NewCookie cookie = NewCookie.valueOf(cookieValue.toString());
            if (OBIBA_ID_COOKIE_NAME.equals(cookie.getName())) {
                return Response.ok().header(HttpHeaders.SET_COOKIE, new NewCookie(OBIBA_ID_COOKIE_NAME, null, "/", cookie.getDomain(), "Obiba session deleted", 0, cookie.isSecure())).build();
            }
        }
    } catch (InvalidSessionException e) {
    // Ignore
    }
    return Response.ok().build();
}
Also used : InvalidSessionException(org.apache.shiro.session.InvalidSessionException) Session(org.apache.shiro.session.Session) NewCookie(javax.ws.rs.core.NewCookie) DELETE(javax.ws.rs.DELETE)

Example 84 with DELETE

use of javax.ws.rs.DELETE in project mica2 by obiba.

the class DataAccessRequestResource method delete.

@DELETE
public Response delete(@PathParam("id") String id) {
    subjectAclService.checkPermission("/data-access-request", "DELETE", id);
    try {
        dataAccessRequestService.delete(id);
        // remove associated comments
        commentsService.delete(DataAccessRequest.class.getSimpleName(), id);
        eventBus.post(new ResourceDeletedEvent("/data-access-request", id));
        eventBus.post(new ResourceDeletedEvent("/data-access-request/" + id, "_status"));
    } catch (NoSuchDataAccessRequestException e) {
    // ignore
    }
    return Response.noContent().build();
}
Also used : DataAccessRequest(org.obiba.mica.access.domain.DataAccessRequest) NoSuchDataAccessRequestException(org.obiba.mica.access.NoSuchDataAccessRequestException) ResourceDeletedEvent(org.obiba.mica.security.event.ResourceDeletedEvent) DELETE(javax.ws.rs.DELETE)

Example 85 with DELETE

use of javax.ws.rs.DELETE in project mica2 by obiba.

the class CommentResource method deleteComment.

@DELETE
public Response deleteComment(@PathParam("id") String id, @PathParam("commentId") String commentId) {
    subjectAclService.checkPermission(String.format("/draft/%s/%s/comment", service.getTypeName(), id), "DELETE", commentId);
    service.findDraft(id);
    commentsService.delete(commentId);
    eventBus.post(new ResourceDeletedEvent(String.format("/draft/%s/%s/comment", service.getTypeName(), id), commentId));
    return Response.noContent().build();
}
Also used : ResourceDeletedEvent(org.obiba.mica.security.event.ResourceDeletedEvent) 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