Search in sources :

Example 1 with DELETE

use of javax.ws.rs.DELETE in project che by eclipse.

the class GitService method deleteRepository.

@DELETE
@Path("repository")
public void deleteRepository(@Context UriInfo uriInfo) throws ApiException {
    final RegisteredProject project = projectRegistry.getProject(projectPath);
    final FolderEntry gitFolder = project.getBaseFolder().getChildFolder(".git");
    gitFolder.getVirtualFile().delete();
    projectRegistry.removeProjectType(projectPath, GitProjectType.TYPE_ID);
}
Also used : FolderEntry(org.eclipse.che.api.project.server.FolderEntry) RegisteredProject(org.eclipse.che.api.project.server.RegisteredProject) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 2 with DELETE

use of javax.ws.rs.DELETE in project che by eclipse.

the class OAuthAuthenticationService method invalidate.

@DELETE
@Path("token")
public void invalidate(@Required @QueryParam("oauth_provider") String oauthProvider) throws BadRequestException, NotFoundException, ServerException, ForbiddenException {
    OAuthAuthenticator oauth = getAuthenticator(oauthProvider);
    final Subject subject = EnvironmentContext.getCurrent().getSubject();
    try {
        if (!oauth.invalidateToken(subject.getUserId())) {
            throw new NotFoundException("OAuth token for user " + subject.getUserId() + " was not found");
        }
    } catch (IOException e) {
        throw new ServerException(e.getMessage());
    }
}
Also used : ServerException(org.eclipse.che.api.core.ServerException) NotFoundException(org.eclipse.che.api.core.NotFoundException) IOException(java.io.IOException) Subject(org.eclipse.che.commons.subject.Subject) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 3 with DELETE

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

the class InterpreterRestApi method removeSetting.

/**
   * Remove interpreter setting
   */
@DELETE
@Path("setting/{settingId}")
@ZeppelinApi
public Response removeSetting(@PathParam("settingId") String settingId) throws IOException {
    logger.info("Remove interpreterSetting {}", settingId);
    interpreterSettingManager.remove(settingId);
    return new JsonResponse(Status.OK).build();
}
Also used : JsonResponse(org.apache.zeppelin.server.JsonResponse) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Example 4 with DELETE

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

the class NotebookRestApi method deleteNote.

/**
   * Delete note REST API
   *
   * @param noteId ID of Note
   * @return JSON with status.OK
   * @throws IOException
   */
@DELETE
@Path("{noteId}")
@ZeppelinApi
public Response deleteNote(@PathParam("noteId") String noteId) throws IOException {
    LOG.info("Delete note {} ", noteId);
    checkIfUserIsOwner(noteId, "Insufficient privileges you cannot delete this note");
    AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
    if (!(noteId.isEmpty())) {
        Note note = notebook.getNote(noteId);
        if (note != null) {
            notebook.removeNote(noteId, subject);
        }
    }
    notebookServer.broadcastNoteList(subject, SecurityUtils.getRoles());
    return new JsonResponse<>(Status.OK, "").build();
}
Also used : Note(org.apache.zeppelin.notebook.Note) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Example 5 with DELETE

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

the class NotebookRestApi method deleteParagraph.

/**
   * Delete paragraph REST API
   *
   * @param noteId ID of Note
   * @return JSON with status.OK
   * @throws IOException
   */
@DELETE
@Path("{noteId}/paragraph/{paragraphId}")
@ZeppelinApi
public Response deleteParagraph(@PathParam("noteId") String noteId, @PathParam("paragraphId") String paragraphId) throws IOException {
    LOG.info("delete paragraph {} {}", noteId, paragraphId);
    Note note = notebook.getNote(noteId);
    checkIfNoteIsNotNull(note);
    checkIfUserCanRead(noteId, "Insufficient privileges you cannot remove paragraph from this note");
    Paragraph p = note.getParagraph(paragraphId);
    checkIfParagraphIsNotNull(p);
    AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
    note.removeParagraph(SecurityUtils.getPrincipal(), paragraphId);
    note.persist(subject);
    notebookServer.broadcastNote(note);
    return new JsonResponse(Status.OK, "").build();
}
Also used : Note(org.apache.zeppelin.notebook.Note) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) JsonResponse(org.apache.zeppelin.server.JsonResponse) Paragraph(org.apache.zeppelin.notebook.Paragraph) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Aggregations

DELETE (javax.ws.rs.DELETE)577 Path (javax.ws.rs.Path)530 Produces (javax.ws.rs.Produces)193 ApiOperation (io.swagger.annotations.ApiOperation)152 ApiResponses (io.swagger.annotations.ApiResponses)126 Consumes (javax.ws.rs.Consumes)76 Timed (com.codahale.metrics.annotation.Timed)59 Response (javax.ws.rs.core.Response)52 IOException (java.io.IOException)46 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 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)20 POST (javax.ws.rs.POST)20 RestSecurityHelper.getIdentity (org.olat.restapi.security.RestSecurityHelper.getIdentity)20 ApiResponse (io.swagger.annotations.ApiResponse)19 HashMap (java.util.HashMap)19 Authorizable (org.apache.nifi.authorization.resource.Authorizable)19